| Show all threads Hide all threads Show all messages Hide all messages |
| how to prove the answer is NO when k > 20 | panyong0202 | 1669. Universal Word | 30 Nov 2014 18:19 | 1 |
I have got ac by return NO when k > 20, but how to prove it? |
| solution by gladoff | DavidРЕМШgladoff#c++ | 1030. Titanic | 30 Nov 2014 11:35 | 1 |
#include <iostream> #include <math.h> using namespace std; const long double D=6875; const long double pi=3.1415926535897932384626433; struct postype{ long double x,y,z; }; int x1,x2,x3,yy1,y2,y3; int sx1,sx2,sx3,syy1,sy2,sy3; char str[100000]; char xstr[10],ystr[10],sxstr[10],systr[10]; postype ship,ice; long double angle1,angle2;
long double dis(double a,double b,double c,double d,double e,double f){ a-=d; b-=e; c-=f; return sqrt(a*a+b*b+c*c); }
int main(){ for (int i=1;i<=3;++i) gets(str); scanf("%d^%d'%d\" %s\n",&x1,&x2,&x3,&xstr); scanf("and %d^%d'%d\" %s\n",&yy1,&y2,&y3,&ystr); gets(str); scanf("%d^%d'%d\" %s\n",&sx1,&sx2,&sx3,&sxstr); scanf("and %d^%d'%d\" %s\n",&syy1,&sy2,&sy3,&systr); gets(str);
double a=x1,b=x2,c=x3; angle1=a*3600+b*60.0+c; angle1/=3600.0*180; angle1*=pi; if (xstr[0]=='S') angle1=-angle1; a=yy1;b=y2;c=y3; angle2=a*3600+b*60.0+c; angle2/=3600.0*180; angle2*=pi; if (ystr[0]=='W') angle2=-angle2; ship.x=D/2*cos(angle1)*cos(angle2); ship.y=D/2*cos(angle1)*sin(angle2); ship.z=D/2*sin(angle1);
a=sx1,b=sx2,c=sx3; angle1=a*3600+b*60+c; angle1/=3600.0*180; angle1*=pi; if (sxstr[0]=='S') angle1=-angle1; a=syy1;b=sy2;c=sy3; angle2=a*3600+b*60+c; angle2/=3600.0*180; angle2*=pi; if (systr[0]=='W') angle2=-angle2; ice.x=D/2*cos(angle1)*cos(angle2); ice.y=D/2*cos(angle1)*sin(angle2); ice.z=D/2*sin(angle1);
long double linedis=dis(ship.x,ship.y,ship.z,ice.x,ice.y,ice.z); linedis/=2; long double AA=asin(linedis*2/D)*2; long double ans=AA; ans=ans*D/2;
printf("The distance to the iceberg: "); cout.precision(2); cout<<fixed; cout<<ans; printf(" miles.\n"); if (100.00-ans>0.005) printf("DANGER!"); } |
| To admins. Please rejudge | Филиппов Илья (УЛ) | 1348. Goat in the Garden 2 | 29 Nov 2014 23:34 | 2 |
I got accepted, but my program dont work on test: 1 1 3 3 2 2 1 correct answer - 0 0.41 my program write - 0.41 0.41 please rejudge Edited by author 21.08.2008 16:27 Edited by author 12.07.2009 05:14 Thanks, your test helps me to get AC :) |
| Never print "NO" | Ade [FDU] | 1647. Divide an Island! | 29 Nov 2014 21:09 | 1 |
|
| how to solve in java | Sherxon WIUT | 1902. Neo-Venice | 29 Nov 2014 18:38 | 1 |
|
| IIIIISSSSOOOOOPPPPP accepted | Doston | 1607. Taxi | 29 Nov 2014 17:41 | 2 |
kodini yozmiman o'zlaringiz toping Accepted Edited by author 29.11.2014 20:35 |
| WA4 | Amandosov | 2015. Zhenya moves from the dormitory | 29 Nov 2014 15:07 | 1 |
WA4 Amandosov 29 Nov 2014 15:07 Please give me some tests this is my code: #include <iostream> using namespace std; int main() { long sj,prj1,prj2,n,k,sd[256],prd[256],kom[256],sh[256],prh[256]; cin>>sj>>prj1>>prj2>>n; for(int i=0;i<n;i++) cin>>sd[i]>>prd[i]; cin>>k; for(int i=0;i<k;i++) cin>>kom[i]>>sh[i]>>prh[i];
long max=-1,nh=0,nd=0;
for(int i=0;i<k;i++) if(kom[i]==1) { if(sh[i]<=sj&&(prj1+prh[i]>max)) {max=prj1+prh[i];nh=i+1;nd=0;}} else { if(sh[i]<=sj&&(prj2+prh[i]>max)) {max=prj2+prh[i];nh=i+1;nd=0;} for(int j=0;j<n;j++) if(sh[i]<=int(double(sj)/2.0+double(sd[j])/2.0)&&(prh[i]+prd[j]>max)) {max=prh[i]+prd[j];nh=i+1;nd=j+1;} }
if(nd==0) {if(nh==0) cout<<"Forget about apartments. Live in the dormitory."<<endl; else cout<<"You should rent the apartment #"<<nh<<" alone."<<endl; } else cout<<"You should rent the apartment #"<<nh<<" with the friend #"<<nd<<"."<<endl;
return 0; } Edited by author 29.11.2014 15:08 |
| wr #11 - Time limit exceed. Help me...!!! | Bahodir | {TUIT} | | 1100. Final Standings | 29 Nov 2014 11:15 | 1 |
import java.util.Scanner; /** * Created by Coder on 25.11.2014. */ public class FinalStandings1100_ { public static void main(String[] args) { Scanner x = new Scanner(System.in); int n = x.nextInt(); int a[][] = new int[n][2]; for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { a[i][j] = x.nextInt(); } } int k = 1; int d = 0 for (int i = 0; i < n; i++) { for (int j = 0; j < n - 1; j++) { if (a[j][k] < a[j + 1][k]) { int v = a[j][d]; a[j][d] = a[j + 1][d]; a[j + 1][d] = v; int c = a[j][k]; a[j][k] = a[j + 1][k]; a[j + 1][k] = c; } } } for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { System.out.print(a[i][j] + " "); } System.out.println(); } } } |
| Pascal 1001 Sqrt | Hawook | 1001. Reverse Root | 29 Nov 2014 10:44 | 2 |
var a: array [0..10] of real; i: integer; begin for i:=0 to 10 do read(a[i]); for i:=0 to 10 do writeln(sqrt(a[10-i]):0:4); end. Why is my answer wrong& Because there are not only 11 numbers. |
| Some Test Case: | Adhambek | 1970. 皇后像廣場 | 29 Nov 2014 07:09 | 1 |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 1 1 1 1 4 4 4 1 5 5 5 2 5 5 5 2 5 5 5 2 3 6 6 6 3 6 6 6 3 6 6 6 2 5 5 5 7 7 4 4 7 7 4 4 7 7 4 4 7 7 4 4 5 5 8 8 5 5 8 8 5 5 8 8 4 4 7 7 9 9 9 8 9 9 9 8 6 6 6 5 6 6 6 5 ans : 1 1 1 1 2 2 2 3 3 3 1 1 1 1 2 2 2 3 3 3 1 1 1 1 2 2 2 3 3 3 1 1 1 1 2 2 2 3 3 3 4 4 4 4 5 5 5 6 6 6 4 4 4 4 5 5 5 6 6 6 4 4 4 4 5 5 5 6 6 6 4 4 4 4 5 5 5 6 6 6 7 7 7 7 8 8 8 9 9 9 7 7 7 7 8 8 8 9 9 9 Edited by author 29.11.2014 07:09 |
| For those who get WA @ Test #16 | TestKiller | 1775. Space Bowling | 28 Nov 2014 22:25 | 2 |
Test 16 contains the special case, where n = k = 1. The answer is obviously 0.000000. I don't understand why the author has put this special case on test 16, I didn't ever think, that it could be a special case. It rather costs me lots of time to debug. |
| If you have WA 2 ... | Alexey Dergunov [Samara SAU] | 1775. Space Bowling | 28 Nov 2014 22:19 | 2 |
... then maybe you misread the statement: 1. Pins have diameter 1, not 0 2. You should output diameter of the ball, not radius Thank you! And it's really interesting that you know exactly how stupid I am. Edited by author 28.11.2014 22:25 |
| WA 7, WHY? | Najmaddin Akhundov | 1017. Staircases | 28 Nov 2014 12:14 | 1 |
|
| Нечётная стоимость | LDV Soft | 2015. Zhenya moves from the dormitory | 28 Nov 2014 01:41 | 3 |
Если двухкомнатная квартира стоит нечётную стоимость, как делится её цена? As like as for even cost. Если была стоимость 5, то каждый платит по 2,5. Если бы делилось как четное, то будет WA18 - проверено. Так что считайте, что могут не целые числа. Edited by author 28.11.2014 01:41 Edited by author 28.11.2014 01:41 |
| a test case for WA#4 | jieshuzheng | 1684. Jack's Last Word | 27 Nov 2014 22:11 | 2 |
ababa ababab if you use kmp, you should pay attention when your index for the first word round up. It takes hours to find the problem. As to me, the problem was with special symbols. In this test end of the first line was defined by two symbols (like Windows style: 10 and 13). |
| How to deal with this problem? | pyh119 | 1004. Sightseeing Trip | 27 Nov 2014 11:43 | 7 |
I can not solve it,please tell me how to solve it,thank you!^_^ You can do this for all edges: 1 - delete edge 2 - find shortest way (Deikstra) between 2 vertex, which are connetcted with this edge 3 - insert edge This solution (O(N^4))pass time limits P.S. It may done in N^3 with Deikstra for each vertex I don't know how to do this :( Is there anything to do with Hamiltonian circuit ? Hamiltonian circuit for n=100 ?!?!?! We will die before your program will give us an answer :O Well... it's not always true that Hamiltonian related problems are NP completed. You can always use some heuristics that will reduce it to polynomial time... so don't be so marked ^^ |
| WRONG at test #5 | cublisan | 1332. Genie Bomber | 26 Nov 2014 21:32 | 3 |
Does anyone know test no. 5? Are there any tricks? Pls HELP me!!! Radius of the bomb can be less than radius of the town. Edited by author 05.04.2006 23:10 Edited by author 05.04.2006 23:10 |
| WA5( | Sonechko | 2023. Donald is a postman | 26 Nov 2014 19:59 | 1 |
WA5( Sonechko 26 Nov 2014 19:59 Подскажите какие могут быть ошибки Please help me Edited by author 26.11.2014 19:59 Edited by author 26.11.2014 19:59 Edited by author 13.01.2015 16:12 |
| how do i submit in python | Light | 1000. A+B Problem | 26 Nov 2014 14:29 | 2 |
a = input() b = input() a = int(a) b = int(b) c = a+b print c
this should be correct isn't it ? It is correct in Python 2, though explicit cast is excessive. In Python 3, use should add brackets after 'print'. |
| why Runtime Error? | Kayzer | 1197. Lonesome Knight | 26 Nov 2014 00:07 | 1 |
import java.io.IOException; import java.util.Scanner; public class chess { static Scanner scn = new Scanner(System.in); public static void main(String args[]) throws IOException{ int n=scn.nextInt(); int[] g = new int[n]; for (int i=0; i<n; i++){ g[i]=game(i);
} System.out.println(""); for (int i=0; i<n; i++){ System.out.println(g[i]);
} } private static int game(int q) throws IOException{ int b = 0, c, f=0; b=count(b); c=scn.nextInt(); if (b-1>0 && c-2>0 && b-1<=8 && c-2<=8) f++; if (b+1>0 && c+2>0 && b-1<=8 && c-2<=8) f++; if (b+1>0 && c+2>0 && b+1<=8 && c+2<=8) f++; if (b-1>0 && c-2>0 && b+1<=8 && c+2<=8) f++; if (c+1>0 && b-2>0 && c+1<=8 && b-2<=8) f++; if (c-1>0 && b+2>0 && c-1<=8 && b+2<=8) f++; if (c+1>0 && b-2>0 && c-1<=8 && b+2<=8) f++; if (c-1>0 && b+2>0 && c+1<=8 && b-2<=8) f++; return f;
} private static int count(int x) throws IOException{ char cd; cd = (char) System.in.read(); if (cd=='a') x=1; if (cd=='b') x=2; if (cd=='c') x=3; if (cd=='d') x=4; if (cd=='e') x=5; if (cd=='f') x=6; if (cd=='g') x=7; if (cd=='h') x=8; return x;
} } |