10773 - Back to Intermediate Math

All about problems in Volume 107. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Raiyan Kamal
Experienced poster
Posts: 106
Joined: Thu Jan 29, 2004 12:07 pm
Location: Bangladesh
Contact:

Post by Raiyan Kamal » Fri Jul 29, 2005 6:13 pm

First line of the input contains an integer N , the number of test cases. Next N lines have 3 real numbers each. So you are supposed to use something like

Code: Select all

for(i=1;i<=N;i++)
{}
No wonder why you get WA using while(cin>>N)

yiuyuho
A great helper
Posts: 325
Joined: Thu Feb 21, 2002 2:00 am
Location: United States
Contact:

Post by yiuyuho » Sun May 20, 2007 8:42 pm

wow, that's some trickery!

But, yea I suppose it is valid, got me too!

yiuyuho
A great helper
Posts: 325
Joined: Thu Feb 21, 2002 2:00 am
Location: United States
Contact:

Post by yiuyuho » Sun May 20, 2007 8:43 pm

Well, with little joey's post now this problem is definitely a lot easier then it is suppose to be :-D

yiuyuho
A great helper
Posts: 325
Joined: Thu Feb 21, 2002 2:00 am
Location: United States
Contact:

Post by yiuyuho » Sun May 20, 2007 8:48 pm

Read http://online-judge.uva.es/board/viewto ... ight=10773

They need to be different paths!

hata_2
New poster
Posts: 2
Joined: Thu Oct 14, 2010 6:23 pm

Re: 10773 - Back to Intermediate Math

Post by hata_2 » Fri Oct 15, 2010 4:56 pm

use "can\'t determine"..its the standard system to print " ' " using \ before it.. i got wa several times only becoz of this bu*****it.

monjur
New poster
Posts: 1
Joined: Sat Feb 26, 2011 8:50 pm

Re: 10773 - Back to Intermediate Math

Post by monjur » Sat Feb 26, 2011 9:14 pm

I cant understand why i got WA repeatedly.
Here is my code:
#include<stdio.h>
#include<math.h>

int main()
{
double result,shortest_time,temp,shortest_path,d;
long cas,n,u,v;
while(scanf("%ld",&n)==1)
{
for(cas=1;cas<=n;cas++)
{
scanf("%lf %ld %ld",&d,&v,&u);
if(u==0 || v==0|| v>=u)
printf("Case %ld: can't determine\n",cas);
else
{
shortest_time=d/u;
temp=double((u*u)-(v*v));
temp=sqrt(temp);
shortest_path=d/temp;
result=fabs(shortest_path-shortest_time);
if(result>=0.001)
printf("Case %ld: %.3lf\n",cas,result);
else
printf("Case %ld: can't determine\n",cas);
}
}
}
return 0;
}

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

Re: 10773 - Back to Intermediate Math

Post by brianfry713 » Sat Oct 22, 2011 9:19 am

monjur wrote:I cant understand why i got WA repeatedly.
Don't check for the number of test cases more than once.
Also don't check if the result>=0.001
Check input and AC output for thousands of problems on uDebug!

nebulousboy
New poster
Posts: 6
Joined: Thu Dec 15, 2011 3:06 pm

Re: 10773 - Back to Intermediate Math

Post by nebulousboy » Sat Dec 31, 2011 7:24 am

if d=0 then how it is possible to determine two different paths?????

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

Re: 10773 - Back to Intermediate Math

Post by brianfry713 » Fri Jan 13, 2012 1:05 am

d is positive
Check input and AC output for thousands of problems on uDebug!

Enayet Kabir
New poster
Posts: 7
Joined: Mon Jun 04, 2012 3:03 pm

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

Post by 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.

brianfry713
Guru
Posts: 5947
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 ?

Post by brianfry713 » Mon Jun 04, 2012 10:34 pm

What's the problem number?
Check input and AC output for thousands of problems on uDebug!

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 ?

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

Problem Number : Uva id:10773(Back to Intermediate math)

brianfry713
Guru
Posts: 5947
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 ?

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

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 ?

Post by 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 ?

brianfry713
Guru
Posts: 5947
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 ?

Post by brianfry713 » Wed Jun 06, 2012 10:26 pm

You asked why you were getting WA, and I gave a suggestion. Congrats on solving it.
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 107 (10700-10799)”