Page 2 of 3
Posted: Fri Aug 04, 2006 10:26 pm
by 898989
Please can you give me some trick test cases
10221 Still WA!!!!!!!!!!!Plz help!
Posted: Mon Sep 11, 2006 3:58 pm
by serendipity
can someone tell why am i getting WA?

I have checked all the test cases provided by the Electronic board. I cannot uderstand also wot wud b the calculation for a=180;
#include<stdio.h>
#include<math.h>
#include<string.h>
#define MAX 5
//#define pi 3.14159265358979323846
#define R 6440
int main(void)
{
double s,a ;
char str[MAX];
double rad, arc, cord, pi;
//freopen("10221.txt","r",stdin);
pi= acos(-1);
while((scanf("%lf%lf%s",&s,&a,str))==3)
{
if(a>180 && !( strcmp(str,"deg")) )
{
a=360-a;
}
if(!(strcmp(str,"deg")))
{
rad=(pi*a)/180;
}
else
{
a=a/60;
rad=(pi*a)/180;
}
/*if(a==180) ///is it ok?????????
{
arc=(R+s)*rad;
cord= 2.0*R+s;
}*/
if (a<=180)
{
arc = (R+s)*rad;
cord=( (R+s)*sin(a/(180/pi)) )/sin((0.5*(180-a))/(180/pi) );
}
printf("%.6lf %.6lf\n",arc, cord);
}
return 0;
}
thanx in advance!
Posted: Tue Sep 12, 2006 10:43 am
by sakhassan
well u had made an silly mistake
....
U should consider a = 180 & when a != 180..
By the way the formula for chord is
Chord_distance=2*radius*sin(angle/2)
for when a != 180
and Chord_distance=2*radius for when a = 180
am thinking r u calculation ur radius as
radius = R or radius = R+s -----> ur mistake
Re: 10221 - Satellites
Posted: Wed Aug 27, 2008 12:48 pm
by newton
All test case has passed but still WA!
where is the problem?
Code: Select all
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#define R 6440
#define PI 2*acos(0.0)
using namespace std;
int main(){
//freopen("in.txt","rt",stdin);
int s,a;
double arcDistance,cordDistance,sinA,sinB;
char str[100];
while(gets(str))
{
sscanf(str,"%d %d %s",&s,&a,str);
if(strstr(str,"min"))
a /= 60;
s = s + R;
arcDistance = s * a * PI/180;
sinA = sin(a*PI/180);
sinB = sin((180 - a)*PI/360);
if(a != 180)
cordDistance = s * sinA / sinB;
else
cordDistance = 2*s;
printf("%.6lf %.6lf\n",fabs(arcDistance),fabs(cordDistance));
}
return 0;
}
Re: 10221 - Satellites
Posted: Tue Sep 09, 2008 9:03 pm
by debugger
Please say, what is my wrong? i am so suppressed.
Code: Select all
#include<stdio.h>
#include<math.h>
int main(){
double s,a,pi,chord,rad,arc;
char ch[6];
pi=2*acos(0.0);
while((scanf("%lf %lf %s",&s, &a, &ch))==3){
if(ch[0]=='m')
a=a/60;
if(a>180)
a=a-180;
rad=pi*a/180;
if(a==180){
arc=pi*(s+6440);
chord=2*(s+6440);
}
else{
chord=2*(s+6440)*sin(rad/2);
arc=rad*(s+6440);
}
printf("%.6lf %.6lf\n",arc,chord);
}
return 0;
}
Quickly. please.

wa pls help
Posted: Tue Feb 03, 2009 2:55 pm
by calicratis19
deleted after ac
Re: 10221 - Satellites
Posted: Mon Mar 16, 2009 9:09 am
by Obaida
reduce calculation.....
Re: 10221 - Satellites
Posted: Fri May 29, 2009 5:25 pm
by calicratis19
Re: 10221 - Satellites
Posted: Mon Aug 10, 2009 10:12 pm
by asif_khan_ak_07
why wrong answer
Code: Select all
#include<stdio.h>
#include<math.h>
#include<string.h>
#define pi 3.1415926535897932384626433832795
int main()
{
//freopen("10221.txt","r",stdin);
int s;
char a[10];
long double ans,temp,len,ac,deg;
while((scanf("%d %Lf %s",&s,°,&a)==3)){
if(!strcmp(a,"min"))
ans=deg/60;
else
ans=deg;
if(ans>180)
ans-360-ans;
ans=(pi*ans)/180;
ac=6440+s;
temp=(ac)*ans;
len=2*ac*ac*cos(ans);
len=(ac*ac)+(ac*ac)-len;
len=sqrt(len);
printf("%.6Lf %.6Lf\n",temp,len);
}
return 0;
}
Re: 10221 - Satellites
Posted: Tue Aug 11, 2009 8:37 pm
by Obaida
@calicratis19 thank you very much. at last worked by reducing calculation.
More variable although with right calculation surly will get wrong answer.
@asif_khan_ak_07 try to reduce your variables. and don't forget to edit this part.
more info in my pm. keep solving

Re: 10221 - Satellites
Posted: Wed Oct 06, 2010 8:01 pm
by fkrafi
Re: 10221 - Satellites
Posted: Thu Jun 23, 2011 6:15 am
by plamplam
Remember, if the angle is greater than 180.0(in degrees), then calculate with 360 - angle size

. Just do the following thing to avoid complexity, take s and a as double and the angle unit as string(Remember to eliminate buffer). Then if str[0] == 'm', angle(a) = a / 60.0. I got AC without adding 1e-8 or stuff like that. Good luck

Re: 10221 - Satellites
Posted: Sun Jul 01, 2012 1:50 am
by sumit saha shawon
I am getting run time error.But I think my code is ok.
My code:
#include<stdio.h>
#include<math.h>
#define pi 2*acos(0)
int main()
{
// double pi=;
double s,angel,rad,radius,ans1,ans2;
char array[5];
while(scanf("%lf%lf%S",&s,&angel,&array)==3)
{
if(angel>180)
angel=360-angel;
//printf("%d\n",angel);
if(array[0]=='m')
angel=angel/60;
rad=(pi/180)*angel;
//printf("%lf\n",rad);
radius=s+6440;
ans1=rad*radius;
ans2=2*radius*sin(rad/2.0);
printf("%0.6lf %0.6lf\n",ans1,ans2);
}
return 0;
}
Re: 10221 - Satellites
Posted: Mon Jul 02, 2012 10:05 pm
by brianfry713
Change line 10 to:
while(scanf("%lf%lf%s",&s,&angel,array)==3)
Re: 10221 - Satellites
Posted: Thu Jul 12, 2012 12:45 pm
by sumit saha shawon
thanks I have got Ac