Page 3 of 4
Indeed.
Posted: Fri Apr 30, 2004 10:40 pm
by _.B._
Indeed!, got accepted by these posts
Keep posting!.
10499 WA need help
Posted: Sun Oct 02, 2005 7:26 am
by zero_cool
I don't know what's wrong with my code. Could anyone give me a critical input???
_____________________________________________________________
code removed
_____________________________________________________________
Posted: Tue Oct 04, 2005 5:46 pm
by bijon
i don't understand this
Code: Select all
cout << div;
switch (rem) {
case 0: cout << "00";
break;
case 1: cout << "25";
break;
case 2: cout << "50";
break;
case 3: cout << "75";
break;
}
why you print div then the other value that is in switch-case.
did your output matches with the sample?
for input
2
your code gives
050%
am i right ?[/code]
Posted: Tue Oct 04, 2005 10:42 pm
by zero_cool
I use div because I've already use double as a data type and i got compile error because of error in output manipulation (i think). And then I changed my code to that. I use long and divide it by 4. and add '25' or '50' or '75' or '00' depend on the remainder. my compiler can't use long long data type so I use that code.
Finally I got accepted. Thanks. By the way, how to manipulate output? I used #include <iomanip> and setprecision, fixed, showpoint but it said compile error.
10499 - Land of Justice WA Help please
Posted: Wed Nov 16, 2005 7:42 pm
by omniscientone
Hi,
I used the following code to generate my output, and can't figure out whats wrong with and why its giving a WA. Any help on why its happening would be appreciated. Any sample input where its wrong would be lovely. Thanks
Code: Select all
#include <iostream>
using namespace std;
int main()
{
int n;
while(1)
{
cin >> n;
if(n < 0)
break;
long prof1 = 0;
if(n > 1)
prof1 += n * 25;
cout << prof1 << "%" << endl;
}
//getch();
}
Thanks guys.
Posted: Wed Nov 16, 2005 7:46 pm
by omniscientone
Forget it, found my mistake, needed to use long long instead of long or int.
Thanks anyways
Posted: Mon Dec 11, 2006 8:48 am
by Steven Luck
I've made it the same, I guess, but still get WA with this code:
Can anyone tell me where the mistake is?
Thanx.
Posted: Fri Dec 22, 2006 8:07 pm
by Debashis Maitra
use long long
and i think
is enough to solve this problem
Posted: Sat Dec 23, 2006 4:47 am
by Steven Luck
Ok, thanx, but if 0 < N < 2^31, isn't it enough if I use long int?
Posted: Sat Dec 23, 2006 5:05 am
by Jan
Suppose N = 2147483647 (2^31-1). The output should be 53687091175 which cant be fit into a normal 32-bit int. So, you can use long long.
Posted: Sat Dec 23, 2006 5:38 am
by Steven Luck
Ok, thanx. I didn't notice the range of the output..

Can we do it...?
Posted: Mon Mar 24, 2008 11:44 am
by Obaida
Thanks... every one
I also got Acc..both time by 25*n...& little joys formula
10499 The Land of Justice getting W/S
Posted: Sat Aug 29, 2009 7:52 am
by noor_aub
I have followed the NSU web help. But I am getting w/a.
I am not getting where I am wrong.
Re: 10499 The Land of Justice getting W/S
Posted: Wed Sep 16, 2009 1:05 am
by saiful_sust
Hi noor_aub
u have two problem
one change int to long
two change this portion of ur code
Code: Select all
if(n==1)
cout<<"0 %"<<endl;
else
cout<<n*25<<" %"<<endl;
To
Code: Select all
p = 25*n;
if(n==1)
cout<<"0%"<<endl;
else
cout<<p<<"%"<<endl;
Then PLZ remove ur code.......
Re: 10499 The Land of Justice getting W/S
Posted: Wed Sep 16, 2009 12:45 pm
by noor_aub
Thanks for your suggestion.