| Show all threads Hide all threads Show all messages Hide all messages |
| This problem seems to be quite easy and i almost sure in the correctness of my program....BUT WA!!!!!!SO HELPHELPHELPHELP | King Without Kingdom | 1093. Darts | 7 Jan 2014 10:53 | 4 |
This is my code: #include<iostream.h> #include<math.h> //ifstream fin("input.txt"); long double cx,cy,cz,nx,ny,nz,r,sx,sy,sz,vx,vy,vz; int main(){ cin >>cx >> cy >> cz >>nx >>ny >>nz >>r >>sx >>sy >>sz >>vx >>vy >>vz; cx-=sx; cy-=sy; cz-=sz; long double V=(nx*vx+ny*vy+nz*vz)/sqrtl(nx*nx+ny*ny+nz*nz); long double G=-(10*nz)/sqrtl(nx*nx+ny*ny+nz*nz); long double L=(cx*nx+cy*ny+cz*nz)/sqrtl(nx*nx+ny*ny+nz*nz); if(V*V+2*L*G<0) { cout << "MISSED\n"; return 0; } long double t=(-V+sqrtl(V*V+2*L*G))/G; if(t>=0) { long double xp=vx*t-cx; long double yp=-cy+vy*t; long double zp=-cz+vz*t-5*t*t; if((xp)*(xp)+(yp)*(yp)+(zp)*(zp)<r*r) { cout << "HIT\n"; return 0; } } t=(-V-sqrtl(V*V+2*L*G))/G; if(t>=0) { long double xp=-cx+vx*t; long double yp=-cy+vy*t; long double zp=-cz+vz*t-5*t*t; if((xp)*(xp)+(yp)*(yp)+(zp)*(zp)<r*r) { cout << "HIT\n"; return 0; } } cout << "MISSED\n"; return 0; } > This is my code: > #include<iostream.h> > #include<math.h> > //ifstream fin("input.txt"); > long double cx,cy,cz,nx,ny,nz,r,sx,sy,sz,vx,vy,vz; > int main(){ > cin >>cx >> cy >> cz >>nx >>ny >>nz >>r >>sx >>sy >>sz >>vx > >>vy >>vz; > cx-=sx; > cy-=sy; > cz-=sz; > long double V=(nx*vx+ny*vy+nz*vz)/sqrtl(nx*nx+ny*ny+nz*nz); > long double G=-(10*nz)/sqrtl(nx*nx+ny*ny+nz*nz); > long double L=(cx*nx+cy*ny+cz*nz)/sqrtl(nx*nx+ny*ny+nz*nz); > if(V*V+2*L*G<0) > { > cout << "MISSED\n"; > return 0; > } > long double t=(-V+sqrtl(V*V+2*L*G))/G; > if(t>=0) > { > long double xp=vx*t-cx; > long double yp=-cy+vy*t; > long double zp=-cz+vz*t-5*t*t; > if((xp)*(xp)+(yp)*(yp)+(zp)*(zp)<r*r) > { > cout << "HIT\n"; > return 0; > } > } > t=(-V-sqrtl(V*V+2*L*G))/G; > if(t>=0) > { > long double xp=-cx+vx*t; > long double yp=-cy+vy*t; > long double zp=-cz+vz*t-5*t*t; > if((xp)*(xp)+(yp)*(yp)+(zp)*(zp)<r*r) > { > cout << "HIT\n"; > return 0; > } > } > cout << "MISSED\n"; > return 0; > } > > > |
| WA1 | Giorgi Shavgulidze [Tbilisi SU] | 1123. Salary | 6 Jan 2014 18:10 | 3 |
WA1 Giorgi Shavgulidze [Tbilisi SU] 27 Mar 2011 04:43 IDK why i get WA1. I think my program is working correctly. Edited by author 27.03.2011 12:16 Re: WA1 TUITUF_Bahrom 1 Oct 2013 18:23 I think not print extra space.My programm print extra space and WA1 |
| Can anybody help me please? What is wrong with my code? | Александр | 1313. Some Words about Sport | 6 Jan 2014 17:13 | 3 |
#include <stdio.h> #include<conio.h> main() { int x[100][100],a,i,j; scanf("%d",&a); for( i = 0 ; i < a ; i++ ) for( j = 0 ; j < a ; j++ ) scanf("%d",&x[i][j]); for( i = 0 ; i < a ; i++ ) for( j = 0 ; j <= i ; j++ ) printf("%d ",x[i-j][j]); for( i = a ; i < 2 * a - 1 ; i++ ) for( j = a - 1 ; j >= i - 3 ; j-- ) printf("%d ",x[j][i-j]); getch(); } Maybe, in order to get full credit point from this task, you should delete the "getch()" ? I do not want to see your sorting algorithm... #include <stdio.h> #include<conio.h> main() { int x[100][100],a,i,j; scanf("%d",&a); for( i = 0 ; i < a ; i++ ) for( j = 0 ; j < a ; j++ ) scanf("%d",&x[i][j]); for( i = 0 ; i < a ; i++ ) for( j = 0 ; j <= i ; j++ ) printf("%d ",x[i-j][j]); for( i = a ; i < 2 * a - 1 ; i++ ) for( j = a - 1 ; j >= i - (a-1) ; j-- ) printf("%d ",x[j][i-j]); } Here's the correct code |
| Best complexity | Alexandru Valeanu | 1198. Jobbery | 5 Jan 2014 13:44 | 1 |
The complexity of the optimal algorithm is O(N + M), because the input is not O(N ^ 2) is O(M). |
| No subject | Dias_97 | 1009. K-based Numbers | 4 Jan 2014 15:28 | 1 |
|
| WA 2 (what's 2nd test?) | green_smile | 1567. SMS-spam | 4 Jan 2014 04:12 | 4 |
I got 1st Test, but 2nd is WA ... it's code var s:char; sum,i:integer; begin sum:=0; while not eof do begin read(s); if (s='a') then sum:= sum+1; if (s='b') then sum:= sum+2; if (s='c') then sum:= sum+3; if (s='d') then sum:= sum+1; if (s='e') then sum:= sum+2; if (s='f') then sum:= sum+3; if (s='g') then sum:= sum+1; if (s='h') then sum:= sum+2; if (s='i') then sum:= sum+3; if (s='j') then sum:= sum+1; if (s='k') then sum:= sum+2; if (s='l') then sum:= sum+3; if (s='m') then sum:= sum+1; if (s='n') then sum:= sum+2; if (s='o') then sum:= sum+3; if (s='p') then sum:= sum+1; if (s='q') then sum:= sum+2; if (s='r') then sum:= sum+3; if (s='s') then sum:= sum+1; if (s='t') then sum:= sum+2; if (s='u') then sum:= sum+3; if (s='v') then sum:= sum+1; if (s='w') then sum:= sum+2; if (s='x') then sum:= sum+3; if (s='w') then sum:= sum+1; if (s='z') then sum:= sum+2; if (s='.') then sum:= sum+1; if (s=',') then sum:= sum+2; if (s='!') then sum:= sum+3; if (s=' ') then sum:= sum+1; end; write(sum); end. just try "you." and "wow." AHAHHAHhhahahahah I got it solved the problem with "you." and "wow." but it stils says WA2 ((( just try "you." and "wow." |
| If you have WA #10... Try this test. | Adhambek | 1433. Diamonds | 3 Jan 2014 15:32 | 1 |
test case : RGBY RGBY answer : equal |
| Help in TEST1 Output | chang | 1019. Line Painting | 3 Jan 2014 06:34 | 1 |
According to the segement discussion, re-paintings include [a,b] and we have to output (a,b), So how the output for TEST1 is (47,634) ? According to me the output should be (47,635) as 634 will be painted due to 3rd repainting.
|
| WA7. Who can help me? | Programmer | 1718. Rejudge | 3 Jan 2014 01:03 | 3 |
Check this test case: 2 A TL 6 A TL 7 Correct answer is 1 1 Check this simple test : 10 Agabek WA 7 Adhambek TL 7 Agabek TL 3 Agabek AC Sirius CE Sirius AC Adhambek WA 5 Sirius WA 5 Sirius ML 7 Adhambek AC answer : 3 3 |
| Some Test for you... | Adhambek | 1355. Bald Spot Revisited | 2 Jan 2014 23:28 | 2 |
My accepted program gives me : test 1 : 5 2 6854726 5664 2 2 34 1 5646532 40 1100000 answer : 2 0 2 5 8 |
| Why Runtime error (stack overflow) C++ help pls!! | Aldar1232 | 1196. History Exam | 2 Jan 2014 22:01 | 2 |
#include <iostream> using namespace std; int main() { int N, M; int S[15001]; int S1[1000001]; cin >> N; for (int i1 = 1; i1 <= N; i1++) cin >> S[i1]; int f = 0; cin >> M; for (int i = 1; i <= M; i++) cin >> S1[i]; for (int i1 = 1; i1 <= N; i1++) for (int i = 1; i <= M; i++) if (S[i1] == S1[i]) f++; cout << f; }
S[15001] <--> S[0..15000] S1[1000001] <--> S1[0..1000000] |
| Tricky question. Read it CAREFULLY. Expand to see the hint. | Ashwin Kumar | 1083. Factorials!!! | 31 Dec 2013 23:42 | 1 |
the product is : n*(n-k)*(n-2*k)... till---> k if divisible by k, i.e. the last non zero value of n OR n(mod)k which is again the last non zero value of n. You don't have to multiply it with k or n mod k again. |
| If you TLE on #3 | Hakkinen | 1007. Code Words | 31 Dec 2013 22:26 | 3 |
May be your program is O(n^2) you can use an array. f[i] means there are f[i] '1' after s[i]. (I can't speak English well.) No additional array is required. Only several auxiliary variables. |
| How to read input in Java? | Nodir NAZAROV Komiljonovich | 1601. AntiCAPS | 31 Dec 2013 22:05 | 2 |
I know how to identify end of console in Pascal, C/C++, but in Java it's not working. Anybody knows? What is the bug in my code? import java.io.*; public class ACM1601 { public static void main(String[] args) throws IOException{
boolean isNewSntc = true; String line=""; int ch; while ((ch = System.in.read()) != -1) { if (isNewSntc){ line += Character.toString((char)ch); isNewSntc = false; } else { line += Character.toString(lowerCase((char)ch)); } if (ch == 46 || ch == 63 || ch == 33) isNewSntc = true; }
System.out.println(line); }
public static char lowerCase(char in) { if ((int)in > 64 && (int)in < 91) return (char) ((int)in + 32); return in; } } Edited by author 31.12.2013 22:26 Edited by author 31.12.2013 22:26 Does this work? import java.io.*; class CopyFirst { public static void main(String[] args) throws IOException { int ch; while ((ch = System.in.read()) != -1) System.out.print((char)ch); } } |
| need test 1 data | Octav Zaharia | 1002. Phone Numbers | 31 Dec 2013 18:41 | 1 |
please send me the test data at least for test 1, i have trouble understanding what is wrong with the code just going blindly, after running all the tests i could find and succeeding still not able to pass first one. tx |
| what's wrong with this code.....???? | shailendrasky | 1639. Chocolate 2 | 31 Dec 2013 01:56 | 1 |
//1639. Chocolate 2 #include<stdio.h> int main() { int n; printf((scanf("%d",&n)*n*scanf("%d",&n)*n)%2==0?"[:=[first]\n":"[second]=:]\n");
} it works fine in my compiler..but don't know why it shows wrong answer here while submission... Edited by author 31.12.2013 01:59 |
| No subject | dake | 1680. The First Nonqualifying | 30 Dec 2013 19:24 | 1 |
Deleted Edited by author 30.12.2013 20:05 |
| WA9 -> AC | Moy | 1745. Yet Another Answer | 30 Dec 2013 16:12 | 1 |
I had some huge problems getting from WA9 to AC. Here is a test that might help you out: Input: 3 )))(( )))) ((((( Output: 14 3 3 1 2 |
| CAN ANYONE TELL ME TEST#2?? GREEDY STRATEGY | Ashwin Kumar | 1167. Bicolored Horses | 30 Dec 2013 14:38 | 1 |
I am using greedy strategy coeff = (unhappiness - possible reduced unhappiness)*length of line x is position to cut the line for min unhappiness ::::: add main list to priority queue with initial unhappiness while(cuts<K){ remove List with max coeff; cut in 2 parts for min unhappiness, calc coeff (for each list); add the 2 parts of list to queue; cuts++; } then poll all queue members(i.e. all cut lines) and add their unhappiness I'm getting all posted tests right.. I tried all variations I could, and I'm getting right answers, but I am getting WA#2, please help!!!! Edited by author 30.12.2013 21:16 |
| printf precision | []zhi (Bozhin Katsarski) | 1489. Points on a Parallelepiped | 30 Dec 2013 02:30 | 2 |
My question is not particularly about this problem, but about printf output with precision 10^-6 or better. In this problem when I use float and output with printf("%.6f", ... ) I get WA8. When I use double and printf("%.6lf", ... ) I get WA1. What is the correct approach please?
I later got AC with this algorithm, it was correct as I had expected. What I did was use double for the points' coordinates and output with ".6f" as if the were float. Why does that work and my other version doesn't? |