Page 4 of 4

### Re: 10925 - Krakovia

Posted: Fri Feb 07, 2014 11:52 pm
Thanks DD, EDIT complet ### Re: 10925 - Krakovia

Posted: Sat Mar 08, 2014 2:01 pm

### Re: 10925 - Krakovia

Posted: Tue Sep 16, 2014 5:17 pm

Code: Select all

``````Accepted!!
``````

### Re: 10925 - Krakovia

Posted: Tue Sep 16, 2014 6:02 pm
After each test case, you should print a blank line.
Don't forget to remove your code after getting accepted. ### Re: 10925 - Krakovia

Posted: Tue Sep 16, 2014 7:54 pm
Is it possible to solve this problem using double instead of creating user defined function for bigint calculation?
Such as I coded using double, which having WA.
Though I can easily solve this by creating user defined function for bigint calculation, but I think this should be solved using double. That's why I want to know is it possible or not, and why?

My Code using double is here:

Code: Select all

``````#include<stdio.h>
#include<math.h>
int main()
{
freopen("10925.txt", "r", stdin);
int i=1,j,n,f;
double v,s,p;
while(scanf("%d %d",&n,&f)==2)
{
if(n==0 && f==0)
break;
s=0;
for(j=1;j<=n;j++)
{
scanf("%lf",&v);
s+=v;
}
p=s/f;
printf("Bill #%d costs %.0lf: each friend should pay %.0lf\n\n",i,s,floor(p));
i++;
}
return 0;
}
``````
And I tested all the input except exceeding 10^20, all work fine. If N==100, and every value of item is 10^20 then maximum value should be 100*10^20=10^22. I think double is enough for it, am I wrong?

### Re: 10925 - Krakovia

Posted: Wed Sep 17, 2014 12:25 am
1 ? N ? 1000. This code shows digits of precision of double, long double.

Code: Select all

``````#include <iostream>
#include <cfloat>

using namespace std;

int main()
{
cout << "DBL_DIG = " << DBL_DIG << endl;
cout << "LDBL_DIG = " << LDBL_DIG << endl;

return 0;
}``````
Output

Code: Select all

``````DBL_DIG = 15
LDBL_DIG = 18``````