11944 - $ 10 to Win?
Posted: Mon Apr 04, 2011 10:11 am
Why Im getting WA??? During contest time, I was also getting WA... But couldn't find any mistakes... would some one plz help me???
Code: Select all
/*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;
double res2=0.0;
for(int i=0;i<count;i++)
{
long int taka;
cin>>taka;
long double am;
if(taka<0)am=(100.00/(long double)(taka*(-1)));
else am=((long double)taka/100.00);
int res=0;
res= ceil(((long double)bett* (long double)am));
bett+= ceil(((long double)res));
res2+= res;
//cout<<am<<" "<<res<<" "<<bett<<" "<<res2<<endl;
}
string s= toString(res2+bet);
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;
}
"akhono try kore jai"