Page 1 of 2
12578 - 10:6:2
Posted: Wed Dec 12, 2012 8:30 pm
by Nut_Boltu
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;
}
Re: 12578 - 10:6:2
Posted: Thu Dec 13, 2012 12:40 am
by brianfry713
Think about what your code is doing when L is not a multiple of 5.
Re: 12578 - 10:6:2
Posted: Thu Dec 13, 2012 3:32 pm
by Nut_Boltu
thanks.... ACC.

Re: 12578 - 10:6:2
Posted: Sun Jan 06, 2013 9:37 am
by alimbubt
Input:
Output:
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
Re: 12578 - 10:6:2
Posted: Tue Feb 19, 2013 12:43 pm
by gr81
really stuck at stupid problem....my code is at
http://ideone.com/9fSszm
please help.
Re: 12578 - 10:6:2
Posted: Tue Feb 19, 2013 5:26 pm
by lbv
Use
double variables, instead of
floats. Check for example:
Input
Output
Code: Select all
125663.71 474336.29
75476.76 284898.24
Re: 12578 - 10:6:2
Posted: Tue Feb 19, 2013 6:47 pm
by gr81
thanks, never thought it will screw me like this.
12578 - 10:6:2
Posted: Sat Jun 01, 2013 2:57 am
by a.a.tanim
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;
}
Re: 12578
Posted: Tue Jun 11, 2013 12:37 am
by brianfry713
Think about what your code is doing when L is not a multiple of 5.
12578 can you find it's bug..?
Posted: Sat Mar 08, 2014 8:27 pm
by mpmohi
I just can't see the problem of this code ....can you
Re: 12578 can you find it's bug..?
Posted: Mon Mar 10, 2014 8:19 pm
by brianfry713
#include <math.h>
try using M_PI instead of your pi constant
12578 - 10:6:2
Posted: Fri Jul 25, 2014 5:15 pm
by Shahidul.CSE
Re: 12578 - 10:6:2
Posted: Fri Jul 25, 2014 6:41 pm
by lighted
Your code is accepted code.
Problems with copy/paste?

Re: 12578 - 10:6:2
Posted: Fri Jul 25, 2014 7:54 pm
by Shahidul.CSE
Thank you. Accepted!
12578 10:6:2
Posted: Thu Oct 30, 2014 2:22 pm
by sabbir25112
What's the problem with my code.?? why it's not accepted.
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;
}