please help me why i am getting WA for my code ?

General topic about Valladolid Online Judge

Moderator: Board moderators

please help me why i am getting WA for my code ?

Postby Enayet Kabir » Mon Jun 04, 2012 3:42 pm

UVA Problem ID :10773(Back to Intermediate Math)
please help anyone...
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
int t,i;
double d,u,v,td,t1,t2;
while(scanf("%d",&t)==1)
{
for(i=1;i<=t;i++)
{
scanf("%lf%lf%lf",&d,&v,&u);
if(u==0 || v>=u || v==0)
{
printf("Case %d: can't determine\n",i);
}
else
{
t1=(1.0*d)/(u*1.0);
t2=(1.0*d)/(sqrt((u*u)-(v*v))*1.0);
td=fabs(t2-t1);
printf("Case %d: %0.3lf\n",i,td );
}

}
}
return 0;
}
Last edited by Enayet Kabir on Tue Jun 05, 2012 4:09 am, edited 1 time in total.
Enayet Kabir
New poster
 
Posts: 7
Joined: Mon Jun 04, 2012 3:03 pm

Re: please help me why i am getting WA for my code ?

Postby brianfry713 » Mon Jun 04, 2012 10:34 pm

What's the problem number?
brianfry713
Guru
 
Posts: 1755
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: please help me why i am getting WA for my code ?

Postby Enayet Kabir » Tue Jun 05, 2012 4:10 am

Problem Number : Uva id:10773(Back to Intermediate math)
Enayet Kabir
New poster
 
Posts: 7
Joined: Mon Jun 04, 2012 3:03 pm

Re: please help me why i am getting WA for my code ?

Postby brianfry713 » Tue Jun 05, 2012 9:13 pm

Input:
Code: Select all
3
8 5 6
1 2 3
1 5 6
3
8 5 6
1 2 3
1 5 6


AC output:
Code: Select all
Case 1: 1.079
Case 2: 0.114
Case 3: 0.135
brianfry713
Guru
 
Posts: 1755
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: please help me why i am getting WA for my code ?

Postby Enayet Kabir » Wed Jun 06, 2012 9:54 pm

What is this sir? Already i have solved this problem . why u give my i/p and o/p ?
Enayet Kabir
New poster
 
Posts: 7
Joined: Mon Jun 04, 2012 3:03 pm

Re: please help me why i am getting WA for my code ?

Postby brianfry713 » Wed Jun 06, 2012 10:26 pm

You asked why you were getting WA, and I gave a suggestion. Congrats on solving it.
brianfry713
Guru
 
Posts: 1755
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: please help me why i am getting WA for my code ?

Postby amjadkhan0988 » Wed Aug 08, 2012 2:16 pm

brianfry713 wrote:What's the problem number?


i think every thing is right no problem is there. :wink:
amjadkhan0988
New poster
 
Posts: 1
Joined: Wed Aug 08, 2012 2:13 pm

Re: please help me why i am getting WA for my code ?

Postby mikhelee12 » Mon Sep 24, 2012 6:59 am

:o i ve checked so many critical input output . i am still getting WA ,,, plz anybody help me,,,, plz,,,, i am trying this for a long time ..... here's my code:
jimmgiht
mikhelee12
New poster
 
Posts: 1
Joined: Mon Sep 24, 2012 6:55 am

Re: please help me why i am getting WA for my code ?

Postby brianfry713 » Tue Sep 25, 2012 12:57 am

mikhelee12 wrote::o i ve checked so many critical input output . i am still getting WA ,,, plz anybody help me,,,, plz,,,, i am trying this for a long time ..... here's my code:

There's no code here.
brianfry713
Guru
 
Posts: 1755
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: please help me why i am getting WA for my code ?

Postby atul » Thu Sep 27, 2012 4:27 pm

Please help me ,,Getting wrong ans..problem no. 488 ..Triangle wave

here is my code

#include <iostream>

using namespace std;

int main()
{
int amp,fre,i,n,j,v,b;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>amp>>fre;
for(j=1;j<=fre;j++)
{

for(int k=1;k<=amp;k++)
{

for(int l=1;l<=k;l++)
cout<<k;
cout<<"\n";

}
for(v=amp-1;v>=1;v--)
{

for(b=1;b<=v;b++)
cout<<v;
cout<<"\n";
}
cout<<"\n";

}
}

return 0;
}
atul
New poster
 
Posts: 4
Joined: Thu Sep 27, 2012 4:21 pm

Re: please help me why i am getting WA for my code ?

Postby brianfry713 » Thu Sep 27, 2012 10:52 pm

NOTE: There is a blank line after each separate waveform, excluding the last one.
brianfry713
Guru
 
Posts: 1755
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: please help me why i am getting WA for my code ?

Postby atul » Sat Sep 29, 2012 11:20 am

I got AC...
Last edited by atul on Sat Sep 29, 2012 11:50 am, edited 1 time in total.
atul
New poster
 
Posts: 4
Joined: Thu Sep 27, 2012 4:21 pm

Re: please help me why i am getting WA for my code ?

Postby atul » Sat Sep 29, 2012 11:48 am

Now it is AC..
I forgor to print newline... :D
atul
New poster
 
Posts: 4
Joined: Thu Sep 27, 2012 4:21 pm

Re: please help me why i am getting WA for my code ?

Postby atul » Fri Oct 05, 2012 12:25 pm

Problem no 1225 ,,,
I am getting WA.. plz help

this is my code

#include <stdio.h>
#include <stdlib.h>

int main()
{
int a[20],i,j,n,m,b,g,s;
scanf("%d",&n);
for(s=1;s<=n;s++)
{
for(i=0;i<20;i++)
{
a[i]=0;
}
scanf("%d",&m);
for(i=1;i<=m;i++)
{
g=i;
if(i<10)
{
a[i]=a[i]+1;
}
else
{
while(g!=0)
{
b=g%10;
g=g/10;
a[b]=a[b]+1;
}
}
}

for(j=0;j<=9;j++)
{
printf("%d",a[j]);
printf(" ");
}
if(s!=n)
printf("\n");
}
return 0;
}
atul
New poster
 
Posts: 4
Joined: Thu Sep 27, 2012 4:21 pm

Re: please help me why i am getting WA for my code ?

Postby brianfry713 » Fri Oct 05, 2012 7:29 pm

Don't print a space at the end of a line.
brianfry713
Guru
 
Posts: 1755
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest