## 10925 - Krakovia

Moderator: Board moderators

shuvokr
Learning poster
Posts: 66
Joined: Tue Oct 02, 2012 8:16 pm

### Re: 10925 - Krakovia

Thanks DD, EDIT complet

Code: Select all

``enjoying life ..... ``

uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

### Re: 10925 - Krakovia

Check input and AC output for over 7,500 problems on uDebug!

musfiqur.cse
New poster
Posts: 10
Joined: Tue Dec 03, 2013 8:48 pm

### Re: 10925 - Krakovia

Code: Select all

``````Accepted!!
``````
Last edited by musfiqur.cse on Fri Sep 19, 2014 10:28 am, edited 1 time in total.

lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 10925 - Krakovia

After each test case, you should print a blank line.
Don't forget to remove your code after getting accepted.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

Shahidul.CSE
Experienced poster
Posts: 148
Joined: Sun Jul 13, 2014 4:32 am

### Re: 10925 - Krakovia

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?
Md. Shahidul Islam
Dept. of CSE at Begum Rokeya University, Rangpur, Bangladesh
UVa id: http://uhunt.felix-halim.net/id/438420
Email me: shahidul.cse.brur@gmail.com

lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 10925 - Krakovia

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``````
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman