Page 14 of 16

Re: why wa 147

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

Re: why wa 147

Posted: Mon Apr 27, 2009 3:45 pm
by mf
Why wa
Can you read???

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?

I suggest you read this article and this paper if you're curious why.

Re: why wa 147

Posted: Mon Apr 27, 2009 4:56 pm
by tobat
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
by fushar
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
by Taman
Thanks to Jan vai for his sample cases :)

Re: 147 __int64 can't hold big results.Please help

Posted: Fri Dec 25, 2009 3:01 pm
by Taman
@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 ;)

Re: 147 __int64 can't hold big results.Please help

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

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 :D :D :D

Re: 147 ,WA

Posted: Fri Jun 11, 2010 3:34 am
by yan yan
everybody please help me :oops: , i don't understand why it's wrong..... :(

Code: Select all

removed after AC

147 how to calculate coin change?

Posted: Wed Oct 20, 2010 5:53 am
by @mjad
please any body help me.
give me an example of coin change made up.

Re: 147 __int64 can't hold big results.Please help

Posted: Fri Jan 14, 2011 9:48 pm
by md_yusuf
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 ....

Re: 147 __int64 can't hold big results.Please help

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

Re: 147 __int64 can't hold big results.Please help

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

Input two integer number
Example

Code: Select all

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

Re: 147 __int64 can't hold big results.Please help

Posted: Wed Jun 29, 2011 2:22 pm
by shamsacm
Pls replace your code

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
by @ce
Getting WA....plzz help...any testcase

Code: Select all

AC

Re: 147 - Dollars

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

Code: Select all

0.30
0.00
AC output:

Code: Select all

  0.30                6