12578 - 10:6:2
Moderator: Board moderators
12578 - 10:6:2
i m getting WA!!!.
plz Help.
#include<cstdio>
#include<cmath>
int main()
{
int T,L;
double redArea,greenArea;
scanf("%d",&T);
while(T--)
{
scanf("%d",&L);
int r=L/5;
int W = L*6/10;
redArea=acos(-1)*pow(r,2);
greenArea=L*W-redArea;
printf("%.2lf %.2lf\n",redArea,greenArea);
}
return 0;
}
plz Help.
#include<cstdio>
#include<cmath>
int main()
{
int T,L;
double redArea,greenArea;
scanf("%d",&T);
while(T--)
{
scanf("%d",&L);
int r=L/5;
int W = L*6/10;
redArea=acos(-1)*pow(r,2);
greenArea=L*W-redArea;
printf("%.2lf %.2lf\n",redArea,greenArea);
}
return 0;
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 12578 - 10:6:2
Think about what your code is doing when L is not a multiple of 5.
Check input and AC output for thousands of problems on uDebug!
Re: 12578 - 10:6:2
thanks.... ACC. ![:D](./images/smilies/icon_biggrin.gif)
![:D](./images/smilies/icon_biggrin.gif)
-
- New poster
- Posts: 39
- Joined: Tue Aug 07, 2012 10:40 pm
- Location: BUBT,Dhaka, Bangladesh
- Contact:
Re: 12578 - 10:6:2
Input:
Output:
Code: Select all
10
33
10
20
30
40
50
60
70
80
97
Code: Select all
136.85 516.55
12.57 47.43
50.27 189.73
113.10 426.90
201.06 758.94
314.16 1185.84
452.39 1707.61
615.75 2324.25
804.25 3035.75
1182.37 4463.03
Give me six hours to chop down a tree and I will spend the first four sharpening the axe...(BUBT ILLUSION)
http://uhunt.felix-halim.net/id/155497
http://onlyprogramming.wordpress.com/
http://uhunt.felix-halim.net/id/155497
http://onlyprogramming.wordpress.com/
Re: 12578 - 10:6:2
really stuck at stupid problem....my code is at http://ideone.com/9fSszm
please help.
please help.
Re: 12578 - 10:6:2
Use double variables, instead of floats. Check for example:gr81 wrote:really stuck at stupid problem....my code is at http://ideone.com/9fSszm
please help.
Input
Code: Select all
2
1000
775
Code: Select all
125663.71 474336.29
75476.76 284898.24
Re: 12578 - 10:6:2
thanks, never thought it will screw me like this.
12578 - 10:6:2
i m getting WA!!!.
plz Help.
#include<stdio.h>
#include<math.h>
#define PI acos(-1)
int main()
{
double a,r;
unsigned n,i,l;
scanf("%u",&n);
for(i=1;i<=n;i++)
{
scanf("%u",&l);
r=PI*(l/5)*(l/5);
a=(6*(l*l))/10;
printf("%.2lf\t%.2lf\n",r,a-r);
}
return 0;
}
plz Help.
#include<stdio.h>
#include<math.h>
#define PI acos(-1)
int main()
{
double a,r;
unsigned n,i,l;
scanf("%u",&n);
for(i=1;i<=n;i++)
{
scanf("%u",&l);
r=PI*(l/5)*(l/5);
a=(6*(l*l))/10;
printf("%.2lf\t%.2lf\n",r,a-r);
}
return 0;
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
12578 can you find it's bug..?
I just can't see the problem of this code ....can you
![:(](./images/smilies/icon_frown.gif)
Code: Select all
Got the solution
Last edited by mpmohi on Sat Nov 22, 2014 10:26 pm, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 12578 can you find it's bug..?
#include <math.h>
try using M_PI instead of your pi constant
try using M_PI instead of your pi constant
Check input and AC output for thousands of problems on uDebug!
-
- Experienced poster
- Posts: 148
- Joined: Sun Jul 13, 2014 4:32 am
- Location: Rangpur, Bangladesh
12578 - 10:6:2
Why WA?
Code: Select all
Removed after Accepted
Last edited by Shahidul.CSE on Fri Jul 25, 2014 7:53 pm, edited 1 time in total.
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: 12578 - 10:6:2
Your code is accepted code.
Problems with copy/paste?![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
Problems with copy/paste?
![:)](./images/smilies/icon_smile.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: 12578 - 10:6:2
Thank you. Accepted!
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
-
- New poster
- Posts: 1
- Joined: Thu Oct 02, 2014 8:54 pm
12578 10:6:2
What's the problem with my code.?? why it's not accepted.
anyone can help plz.
anyone can help plz.
Code: Select all
#include<stdio.h>
#include<math.h>
#define PI acos(-1)
int main()
{
int test,i;
float l,w,r;
while(scanf("%d",&test)==1)
{
for(i=1;i<=test;i++)
{
scanf("%f",&l);
w = 0.6*l;
r = l/5;
printf("%.2f %.2f\n",PI*r*r,(l*w)-(PI*r*r));
}
}
return 0;
}
Last edited by brianfry713 on Thu Oct 30, 2014 9:13 pm, edited 1 time in total.
Reason: Added code blocks
Reason: Added code blocks