## 12578 - 10:6:2

Moderator: Board moderators

Nut_Boltu
New poster
Posts: 10
Joined: Wed Dec 12, 2012 7:47 pm

### 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;
}

brianfry713
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!

Nut_Boltu
New poster
Posts: 10
Joined: Wed Dec 12, 2012 7:47 pm

### Re: 12578 - 10:6:2

thanks.... ACC.

alimbubt
New poster
Posts: 39
Joined: Tue Aug 07, 2012 10:40 pm
Contact:

### Re: 12578 - 10:6:2

Input:

Code: Select all

10
33
10
20
30
40
50
60
70
80
97
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
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/

gr81
New poster
Posts: 46
Joined: Wed Sep 26, 2012 7:52 pm

### Re: 12578 - 10:6:2

really stuck at stupid problem....my code is at http://ideone.com/9fSszm

lbv
Experienced poster
Posts: 128
Joined: Tue Nov 29, 2011 8:40 am

### Re: 12578 - 10:6:2

gr81 wrote:really stuck at stupid problem....my code is at http://ideone.com/9fSszm
Use double variables, instead of floats. Check for example:

Input

Code: Select all

2
1000
775
Output

Code: Select all

125663.71 474336.29
75476.76 284898.24

gr81
New poster
Posts: 46
Joined: Wed Sep 26, 2012 7:52 pm

### Re: 12578 - 10:6:2

thanks, never thought it will screw me like this.

a.a.tanim
New poster
Posts: 1
Joined: Sat Jun 01, 2013 2:44 am

### 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;
}

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 12578

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!

mpmohi
New poster
Posts: 13
Joined: Wed Feb 26, 2014 10:15 pm

### 12578 can you find it's bug..?

I just can't see the problem of this code ....can you

Code: Select all

Got the solution
Last edited by mpmohi on Sat Nov 22, 2014 10:26 pm, edited 1 time in total.

brianfry713
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>
Check input and AC output for thousands of problems on uDebug!

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

### 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
Email me: shahidul.cse.brur@gmail.com

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

### Re: 12578 - 10:6:2

Problems with copy/paste?
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: 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
Email me: shahidul.cse.brur@gmail.com

sabbir25112
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.

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.