Page 14 of 16

### Re: why wa 147

Posted: Mon Apr 27, 2009 3:32 pm
It's accepted!

### Re: why wa 147

Posted: Mon Apr 27, 2009 3:45 pm
Why wa

You made exactly the same mistake as almost everyone who posted here about their WA.

In short, to illustrate what it is, consider the following C/C++ boolean expressions:

Code: Select all

``````(int)(0.29 * 100) == 28
(int)(0.57 * 100) == 56
(int)(0.58 * 100) == 57
(int)(1.13 * 100) == 112
(int)(1.14 * 100) == 113
(int)(1.15 * 100) == 114
...``````
Here's the bummer: they all evaluate to true. You didn't see that coming, did you?

### Re: why wa 147

Posted: Mon Apr 27, 2009 4:56 pm
Thank you very much!
I'm so careless!
now I get AC,I will be careful next.
Thanks again.

### Re: why wa 147

Posted: Tue Apr 28, 2009 12:20 am
I didn't use any floating point in this problem. To read the input, just type:

Code: Select all

``scanf("%d.%d", &note, &coin);``
It's so simple right?

### Re: 147 ,WA

Posted: Fri Dec 25, 2009 2:58 pm
Thanks to Jan vai for his sample cases

Posted: Fri Dec 25, 2009 3:01 pm
@Newton: Hope that I am too late. You have solved the problem btt.
check these inputs :
0.11
0.12
0.01

And the title of this thread is wrong:)
long long is enough for this problem. @ least I got acc using %lld

Posted: Sat Jan 09, 2010 5:43 am
i know why your code is WA :

Code: Select all

``printf("%6.2f%17llu\n", input, ways[ans]);``
should :

Code: Select all

``printf("%6.2f%17llu\n", input[b]+eps[/b], ways[ans]);``
only thats, n you will AC

### Re: 147 ,WA

Posted: Fri Jun 11, 2010 3:34 am

Code: Select all

``````removed after AC
``````

### 147 how to calculate coin change?

Posted: Wed Oct 20, 2010 5:53 am
give me an example of coin change made up.

Posted: Fri Jan 14, 2011 9:48 pm
plz help me.. why wa..

Code: Select all

``````#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

unsigned long long a[50000];

int main()
{
unsigned long long i,j;
int coin[]={5,10,20,50,100,200,500,1000,2000,5000,10000};
a[0]=1;
for(i=0;i<11;i++)
{
for(j=0;j<=30000;j++)
a[j+coin[i]]+=a[j];
}
double n;
while(1)
{
scanf("%lf",&n);
int m;
m=n*100;
if(m==0)
break;
printf("%6.2lf%17llu\n",n,a[m]);
}
}

``````
i have check answer in uvatoolkit i think i have problem in output plz help me.
plz help im getting frustrated ....

Posted: Sat Jan 15, 2011 4:50 pm
Rather than doing-
m= (n* 100), do this:
m = (int) (n * 100 + 0.5) to avoid floating point error.

Posted: Wed Jun 29, 2011 2:17 pm
For floating point error

Input two integer number
Example

Code: Select all

``````scanf("%d.%d",&d,&c);
amount = d*100 + c;``````

Posted: Wed Jun 29, 2011 2:22 pm

Use integer not floating point

Code: Select all

`````` //scanf("%lf",&n);
scanf("%d.%d",&d,&c);
int m;
//m=n*100;
m = d*100+c;
if(m==0)
break;
//printf("%6.2lf%17llu\n",n,a[m]);
printf("%3d.%.2d%17llu\n",d,c,a[m]);``````

### 147 - Dollars

Posted: Mon Dec 31, 2012 8:51 am
Getting WA....plzz help...any testcase

Code: Select all

``AC``

### Re: 147 - Dollars

Posted: Tue Jan 01, 2013 3:04 am
Input:

Code: Select all

``````0.30
0.00``````
AC output:

Code: Select all

``  0.30                6``