Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*in the name of Allah */
- # include <list>
- # include <deque>
- # include <bitset>
- # include <algorithm>
- # include <functional>
- # include <numeric>
- # include <utility>
- # include <sstream>
- # include <iostream>
- # include <iomanip>
- # include <cstdio>
- # include <cmath>
- # include <cstdlib>
- # include <ctime>
- # include <set>
- # include <map>
- # include <cmath>
- # include <queue>
- # include <limits>
- # include <stack>
- # include <vector>
- # include <cstring>
- # include <cstdio>
- using namespace std;
- # define MEM(array,w) memset(array,w,sizeof array)
- # define fr(i,a,b) for(int (i) = a ; i < b ; i++)
- # define SET set<int>::iterator it = s.begin(); it != s.end();it++
- # define ULL unsigned long long
- # define eps 1e-9
- # define SS stringstream
- # define PR pair<int , int>
- # define all(c) (c).begin(), (c).end()
- # define maxint 1 << 31 - 1
- # define FOR(i, a, b) for (int i=a; i<b; i++)
- # define REP(i, a) FOR(i, 0, a)
- # define rive(s) reverse(s.begin(),s.end())
- # define OK(R,C) if(i>=0 && j>=0 && j<=C && i<=R)
- template<class T> string toString(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}
- int toInt(string s){int r=0;istringstream sin(s);sin>>r;return r;}
- 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;}
- int pel(string s){string t;t=s;reverse(t.begin(),t.end());if(s==t)return 1;return 0;}
- int main()
- {
- long int weg;
- cin>>weg;
- long int we=weg;
- int ca=0;
- while(weg--)
- {
- int bet, bett=0, count;
- cin>>bet>>count;
- bett=bet;
- long int res2=0.0;
- for(int i=0;i<count;i++)
- {
- long double taka;
- cin>>taka;
- //if(taka>1000000.00)taka=1000000.00;
- long double am;
- if(taka<0)am=(100.00/(taka*(-1)));
- else am=(taka /100.00);
- long int res=0;
- res= ceil(bett*(am));
- if(res>1000000.00)res=1000000.00;
- bett+= ceil(res);
- res2+= res;
- // cout<<am<<" "<<res<<" "<<bett<<" "<<res2<<endl;
- }
- //res2=100000012;
- if(res2>1000000)res2=1000000;
- res2+=bet;
- string s= toString(res2);
- string ress="";
- rive(s);
- for(int i=0;i<s.size();i++)
- {
- ress+=s[i];
- if(i>0 && i%3==2 && i!=s.size()-1)ress+=",";
- }
- rive(ress);
- printf("%d $",++ca);cout<<ress<<".00"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement