Show all threads Hide all threads Show all messages Hide all messages |
What's wrong with compilation? | Yarik | | 25 Jul 2007 22:29 | 2 |
Why does this string of code cause "Compilation error": vector<vector<string>>* middleresult; ? I my MSVS compiler it goes well. But not here... :( Tnx for any help. Just input one more space character in middleresult's declaration: vector< vector<string> >* middleresult; Many compilers proceed ">>" at this declarations as binary shifting. Edited by author 25.07.2007 22:29 |
What's wrong in my code? | vasya | 1001. Reverse Root | 25 Jul 2007 22:26 | 2 |
#include <iostream> #include <math.h> using namespace std; int main() { long b=-1,c; long A[10000]; while(cin>>c) { b=b+1; A[b-1]=c; } for(int i=b-1;i>=0;i--) { printf(".4ld\n",sqrt(double(A[i]))); } return 0; } Edited by author 25.07.2007 20:00 You must wrote "for(int i=b;i>=0;i--)" or initialize b as "0". Your code dont process last inputted number. P.S. And, by the way, you can write "b++" instead of "b=b+1" ;) This is C++, enjoy it =) |
What's the answer for this input??? | Vladimir Milenov Vasilev | 1191. Catch the thief! | 25 Jul 2007 19:37 | 6 |
What is the output for this two inputs?? 3 2 1 2 and 3 2 1 2 2 > What is the output for this two inputs?? > > 3 2 > 1 2 > YES > > and > > 3 2 > 1 2 2 > YES IMHO > What is the output for this two inputs?? > > 3 2 > 1 2 > YES > > and > > 3 2 > 1 2 2 > YES IMHO > What is the output for this two inputs?? > > 3 2 > 1 2 > > > and > > 3 2 > 1 2 2 What is the output for this two inputs?? 3 2 1 2 Answer: NO and 3 2 1 2 2 Answer: NO Edited by author 28.06.2007 19:38Second case is incorrect. It must be 3 3 1 2 2 |
What's wrong with my code? | Neolisk | 1001. Reverse Root | 25 Jul 2007 06:11 | 6 |
#include <stdio.h> #include <math.h> void main() { double n; while(scanf("%lf",&n) != EOF) printf("%.4lf\n",sqrt(n)); } It gets WA on the 1st test, although it should work (in theory). The problem is that I can't check whether it reads as it should just because I don't know how to put EOF symbol at the end of the input manually. Does anyone know how it should be done? Edited by author 09.07.2007 20:30 You must output answers in reverse order!Good luck! Maybe it'll help you: [code deleted] Edited by author 09.07.2007 23:32 Edited by author 09.07.2007 23:51 Edited by author 10.07.2007 00:28 Edited by author 12.07.2007 03:12 Thank you very much! How could I miss that... Probably because I'm not that good at stream handling and focused my mind on finding other ways to read/write streams in C/C++. Yet this code gets CE on submit, but it doesn't on my PC. Is it because those written here don't count? :)) I write this program on C++.Try to send it on C++ && you'll get AC.I create dynamic array & maybe in C it gets CE.Good luck! Edited by author 10.07.2007 23:59 Unfortunately I'm not that good at C++ console streams. How do I check the end of output? (cin >> a) != EOF Is that correct? You can check the end of output in such a way: while( cin >> a ) { //--your code--- } |
bad testset: prog bith BUG got AC | dgorlov | 1253. Necrologues | 24 Jul 2007 16:39 | 2 |
my AC program for these test 4 zzz*2# *3*4# *2# www# gives output zzz it's wrong correct output is # |
I suspect the test case #13 have some other characters, not only '>', '<' and CR/LF. | RoBa @ TJU | 1135. Recruits | 23 Jul 2007 21:58 | 3 |
att Edited by author 20.09.2006 14:31 Yes you are right. When I am read (cin >> s), where s is string, I got WA13. When I am read by getchar, and bring in string '>' or '<', I got AC You can not use cin >> s because there are CR/LF characters in the input. For example such test is correct: 4 >> << P.S. Test 13 is correct now. Edited by author 23.07.2007 22:31 |
Why are for (int i = 0; i < 80; i++) printf("%c",ans[i]) and printf ("%s\n", ans) different..? | CO2 | 1094. E-screen | 23 Jul 2007 21:52 | 1 |
The first one got AC but the second one got WA. I have initialized every char in ans to be ' '. OH, I see... I should let ans[80] to be '\0'... sorry..~ Edited by author 23.07.2007 21:58 |
Some hints (DONT read this if you want to think yourself) | Fokysnik | 1206. Sum of Digits of the Sum of Numbers | 23 Jul 2007 17:54 | 2 |
The equality holds when the sum of i-th digits of numbers A and B (A[i]+B[i]<=9) Using this write a simple program. It will be a TL program but... try running it for k=1,2,3,4,5,6,7 and you should notice a rule how the answer for k+1 is formed. And one more thing. You should use long arithmetics. For k=50 answer has 87 digits. Good luck. |
2Admins - question | jerzydabczak | 1002. Phone Numbers | 23 Jul 2007 17:44 | 1 |
Can one word appear only at most once or more times? |
pretty good program but WA on 3 test what the fucking test is it? | Astalavista_Baby | 1131. Copying | 23 Jul 2007 06:47 | 3 |
#include <stdio.h> #include <math.h> long int n, k, hour; double x, y; int main(void) { scanf("%ld%ld", &n, &k); if (n == 1) { printf("0\n"); return 0; } n--; x = floor(log(k)/log(2)) + 1; y = pow(2, x) - 1; n -= y; hour = x; hour += n / k; if (n % k != 0) hour++; printf("%ld\n", hour); return 0; } What the fucking test. I test this program on sophisticated tests but vsio katu pod xvost. :-P if you find your mistake, please tall me. I got WA#3 first, but now - AC. Try K>N into your program. |
Problem 1019 "A Line painting" has been rejudged (+) | Sandro (USU) | 1019. Line Painting | 22 Jul 2007 22:12 | 2 |
New tests were added. 275 authors lost AC. |
1001 | Selefanov Sergey | 1001. Reverse Root | 22 Jul 2007 18:07 | 5 |
1001 Selefanov Sergey 19 Jul 2007 03:35 what finish the flow of the entering? since there are absent "." or "0" at the end of the entering Re: 1001 Mace(Lviv Polytechniс NU) 19 Jul 2007 12:38 Re: EOF Selefanov Sergey 21 Jul 2007 17:49 In my understanding use EOF possible when reading from file, but in given task entering by means of keyboard Re: EOF Mace(Lviv Polytechniс NU) 22 Jul 2007 18:07 |
FOR ALL Who don't no how input data (WA1) | Dim@lish (MAI) | 1007. Code Words | 22 Jul 2007 15:33 | 1 |
For example program must work some: 4 <INPUT 0000 <INPUT 0000 >OUTPUT 011 <INPUT 0110 >OUTPUT 1011 <INPUT 1001 >OUTPUT 11011<INPUT 1111 >OUTPUT using EOF allways in INPUT |
TO ADMINS: mistake in condition! (+) | DixonD (Lviv NU) | 1392. Dreaming of Stars | 21 Jul 2007 21:43 | 3 |
Condition of problem says that "Two planets have stuck each other if they have at least one common point" But sample #1 show that it must be "Two planets have stuck each other if they have at least two common points" . I used this fact and got AC. Please, correct this. Edited by author 15.07.2007 01:56 I still wait for answer... Edited by author 20.07.2007 15:31 |
Why I got WA? | Bill@sxyz | 1012. K-based Numbers. Version 2 | 21 Jul 2007 16:47 | 2 |
program ural_1012; var a1,a0,p:longint; n,k,i:integer; begin readln(n,k); a1:=k-1; for i:=2 to n do begin p:=a1; a1:=(a1+a0)*(k-1); a0:=p; end; writeln(a1+a0); end. Because you are very ugly! ~~~~ Edited by author 21.07.2007 16:48 |
To Admins | M@STeR.SoBG | 1080. Map Coloring | 20 Jul 2007 20:06 | 3 |
Look at this test: 2 0 0 My accepted program outputs "0-1" when the right answer is "00". From problem statement: "From every country we can reach to any other one". Your test is incorrect. Sorry!! I was wrong. I'll read problem statements more carefully . :-) |
WA#1 :) test #1 is sample test, isn't? | Alias (Alexander Prudaev) | 1469. No Smoking! | 19 Jul 2007 14:29 | 3 |
i implement sweep line algorithm, using STL set Hmmm... I also have WA-1 but my program works correct on the samples |
Please test my code, because I think it's ok | Marko Bogdanovic | 1049. Brave Balloonists | 19 Jul 2007 13:22 | 2 |
Please try my program for different input data, I don't know where I am wrong. Maybe I missunderstood problem, everyone use array, I don't think it's necessary ?! #include <iostream.h> #include <math.h> int main() { int niz[10]; int brojac = 1; int rezultat; int p = 1; int koren; for (int i = 0; i < 10; i++) cin >> niz[i]; for (int j = 0; j < 10; j++) p = p * niz[j]; if (p == 1) { cout <<1; return 0; } koren = floor(sqrt((double)p)); for (int k = 2; k <=koren; k++) { if (p % k == 0) { if (p/k == k) brojac++; else brojac = brojac + 2; } } brojac++; rezultat = brojac % 10; cout << rezultat; return 0; } What your answer for test: 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 For this test p=10^40. |
WA #3... Please, give me some usefull tests! | DixonD (Lviv NU) | 1111. Squares | 18 Jul 2007 17:14 | 1 |
Please, post some tests... |
1321-logical puzzle of very high level | svr | 1321. Floor Indicator | 18 Jul 2007 14:36 | 1 |
|