![:D](./images/smilies/icon_biggrin.gif)
10925 - Krakovia
Moderator: Board moderators
-
- 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.
Re: 10925 - Krakovia
Don't forget to remove your code after getting accepted.After each test case, you should print a blank line.
![8)](./images/smilies/icon_cool.gif)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
-
- Experienced poster
- Posts: 148
- Joined: Sun Jul 13, 2014 4:32 am
- Location: Rangpur, Bangladesh
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:
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?
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;
}
Md. Shahidul Islam
Dept. of CSE at Begum Rokeya University, Rangpur, Bangladesh
UVa id: http://uhunt.felix-halim.net/id/438420
My facebook account,
Email me: shahidul.cse.brur@gmail.com
Dept. of CSE at Begum Rokeya University, Rangpur, Bangladesh
UVa id: http://uhunt.felix-halim.net/id/438420
My facebook account,
Email me: shahidul.cse.brur@gmail.com
Re: 10925 - Krakovia
1 ? N ? 1000. This code shows digits of precision of double, long double.
Output
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;
}
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