Advertisement
Eather

11944- $10 to win?

Apr 4th, 2011
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.28 KB | None | 0 0
  1.                            /*in the name of Allah */
  2.  
  3.  
  4. # include <list>
  5. # include <deque>
  6. # include <bitset>
  7. # include <algorithm>
  8. # include <functional>
  9. # include <numeric>
  10. # include <utility>
  11. # include <sstream>
  12. # include <iostream>
  13. # include <iomanip>
  14. # include <cstdio>
  15. # include <cmath>
  16. # include <cstdlib>
  17. # include <ctime>
  18. # include <set>
  19. # include <map>
  20. # include <cmath>
  21. # include <queue>
  22. # include <limits>
  23. # include <stack>
  24. # include <vector>
  25. # include <cstring>
  26. # include <cstdio>
  27. using namespace std;
  28.  
  29. # define MEM(array,w)   memset(array,w,sizeof array)
  30. # define fr(i,a,b) for(int (i) = a ; i < b ; i++)
  31. # define SET set<int>::iterator it = s.begin(); it != s.end();it++
  32. # define ULL unsigned long long
  33. # define eps 1e-9
  34. # define SS stringstream
  35. # define PR pair<int , int>
  36. # define all(c) (c).begin(), (c).end()
  37. # define maxint 1 << 31 - 1
  38. # define FOR(i, a, b) for (int i=a; i<b; i++)
  39. # define REP(i, a) FOR(i, 0, a)
  40. # define rive(s) reverse(s.begin(),s.end())
  41. # define OK(R,C) if(i>=0 && j>=0 && j<=C && i<=R)
  42.  
  43. template<class T> string toString(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}
  44.  
  45. int toInt(string s){int r=0;istringstream sin(s);sin>>r;return r;}
  46.  
  47. bool isprime(int n){if( n<2) return 0;for( int i=2; i*i<=n ; i++)if(n%i==0)return 0; return 1;return 0;}
  48.  
  49. int pel(string s){string t;t=s;reverse(t.begin(),t.end());if(s==t)return 1;return 0;}
  50.  
  51.  
  52. int main()
  53. {
  54.  
  55. long int weg;
  56. cin>>weg;
  57. long int we=weg;
  58. int ca=0;
  59. while(weg--)
  60. {
  61.   int bet, bett=0, count;
  62.  
  63.   cin>>bet>>count;
  64.   bett=bet;
  65.   long int res2=0.0;
  66.  
  67.   for(int i=0;i<count;i++)
  68.   {
  69.     long double  taka;
  70.     cin>>taka;
  71.  
  72.     //if(taka>1000000.00)taka=1000000.00;
  73.  
  74.     long double am;
  75.     if(taka<0)am=(100.00/(taka*(-1)));
  76.     else am=(taka /100.00);
  77.  
  78.     long int res=0;
  79.     res= ceil(bett*(am));
  80.     if(res>1000000.00)res=1000000.00;
  81.     bett+= ceil(res);
  82.     res2+= res;
  83.    // cout<<am<<" "<<res<<" "<<bett<<" "<<res2<<endl;
  84.   }
  85.   //res2=100000012;
  86.   if(res2>1000000)res2=1000000;
  87. res2+=bet;
  88.  
  89.  
  90.   string s= toString(res2);
  91.   string ress="";
  92.  
  93.   rive(s);
  94.  
  95.   for(int i=0;i<s.size();i++)
  96.   {
  97.     ress+=s[i];
  98.     if(i>0 && i%3==2 && i!=s.size()-1)ress+=",";
  99.   }
  100.   rive(ress);
  101.   printf("%d $",++ca);cout<<ress<<".00"<<endl;
  102.  
  103. }
  104. return 0;
  105.  
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement