| Show all threads Hide all threads Show all messages Hide all messages |
| this one prefer "double" rather than "float" | Feng | 1001. Reverse Root | 10 Apr 2009 12:06 | 1 |
accept this kind of double: #include <vector> #include <iostream> #include <algorithm> #include <iterator> #include <cmath> using namespace std; void root( double& d ) { d = sqrt(d); } int main() { vector<double> arr; copy( istream_iterator<double>(cin), istream_iterator<double>(), back_inserter(arr) ); for_each( arr.begin(), arr.end(), root ); cout.precision(4); cout << fixed; copy( arr.rbegin(), arr.rend(), ostream_iterator<double>(cout, "\n")); return 0; } Wrong answer of "float" type: #include <vector> #include <iostream> #include <algorithm> #include <iterator> #include <cmath> using namespace std; void root( float& d ) { d = sqrt(d); } int main() { vector<float> arr; copy( istream_iterator<float>(cin), istream_iterator<float>(), back_inserter(arr) ); for_each( arr.begin(), arr.end(), root ); cout.precision(4); cout << fixed; copy( arr.rbegin(), arr.rend(), ostream_iterator<float>(cout, "\n")); return 0; } strange problem ...... |
| test data | lian lian | 1402. Cocktails | 10 Apr 2009 02:09 | 2 |
if (n==1||n==2) what is the answer the subject? for 1 the answer is 0 for 2 the answer is 2 |
| WA on test 13, Please help | Lev Panov | 1402. Cocktails | 10 Apr 2009 01:58 | 6 |
This is my solution: #include <stdio.h> long double fact( long double n ) { if (n < 2) return 1; else return n * fact(n - 1); } int main( void ) { long double n, nfac, ans = 0, i;
scanf("%Lf", &n);
if (n < 2) { printf("0"); return 0; }
nfac = fact(n);
for (i = 2; i < n; i ++) ans += nfac / fact(n - i);
ans += nfac;
printf("%.0Lf", ans);
return 0; } WTF? Check your answers to maxtests: 21 => 138879579704209680000 20 => 6613313319248079980 PS: Idea of solution is correct, but you should store answer in suitable type ("long double" is not enough). Hmm, I actually have correct answers for n = 20 and 21. And "long double" is extremely big type, for example: 100 => 253686955560127297296368144135170000933446331847165085913916476338770833469945019420289324705338829425834316771115322447713278811189027647015804045741541818368 =)) What's wrong then? "long double" can store numbers about 10^{4000} but only first 19 digits are calculated right. Btw, I think, you use some else compiler, not Intel-C++, am I right? Yep, you're right: I use GNU GCC. Ok, I will try to use "long long" type. you are so stupid max n is 21 not 100 |
| wa#1?? (to judges: statement of the problem should be modifed) | Alexander Kouprin | 1074. Very Short Problem | 10 Apr 2009 00:17 | 2 |
why 10 0.0 -0.0 1100000000000000000000000000000.0000000000 -0.0 24680976.32135864232426891300 Not a floating point number Not a floating point number is incorrect output for the sample (test#1)? Edited by author 24.10.2008 23:22 'cause you can't write -0.0 I've never seen something like that. Maybe you have? |
| Crash on test 1 | MOPDOBOPOT | 1709. Penguin-Avia | 9 Apr 2009 19:21 | 2 |
What the test? Sample working correct on my computer. Edited by author 09.04.2009 18:13 First test is sample. Check your solution again. |
| To admin:please add this test. | yuyan | 1547. Password Search | 9 Apr 2009 15:21 | 2 |
The test is 2 27 I found that some AC solution output like that: a-z {-az ba-bz It means that the testdatas do not strong enough. Please add this. By the way,I guess the test 10 may be have some characters that do not in ['a'..'z','-'] Please check it. At last,sorry for my poor English. Thank you. Test 10 is correct.I'm sorry. |
| Problem 1274 Fractional Arithmetic rejudged | Vladimir Yakovlev (USU) | 1274. Fractional Arithmetic | 9 Apr 2009 12:17 | 1 |
New tests have been added. Accepted solutions have been rejudged. 295 authors have lost AC after rejudge. |
| WA6,HELP!!! | yangqiang | 1067. Disk Tree | 9 Apr 2009 06:49 | 1 |
Could someone give me some tests?? |
| Complexity(+) | vav[14] | 1626. Interfering Segment | 9 Apr 2009 04:52 | 3 |
Can this problem be solved better than O(N^3)? This problem is supposed to be solved in O(n^3) with small constant factor by author Actually, O(N^2 log N) of geometry + O(N^3) of bit operations. This may give you an idea of the solution. |
| WA Test 2 | ZeleninAA | 1700. Awakening | 8 Apr 2009 18:28 | 1 |
|
| Input/output | Helen_N | | 8 Apr 2009 18:20 | 1 |
Hello! How must be organized input from console for a series of numbers, which quantity isn't known? If we worked with file i/o, we could check for symbol, that means end of file. And what is the condition to break input here? |
| What does it mean? | OpenGL | 1708. Sum of Digits 2 | 8 Apr 2009 17:34 | 1 |
It is allowed that the empty string matches several patterns. ??? |
| Sample output is nuts | DarkeN | 1121. Branches | 8 Apr 2009 15:53 | 1 |
I seriously think that sample output is screwed up. For example, the lowest line reads: -1 1 4 - 1 4 But taking into account the proximity of the branch with ID=4 (bin: 100) and the branch with ID=1 (bin: 001) shouldn't all non-negative numbers in line equal 5( bin: 101), like -1 5 5 -1 5 ? Could someone make it clear for me? I would be very grateful;-) |
| Compilation Error | Shelest Pavlo | 1521. War Games 2 | 8 Apr 2009 15:20 | 1 |
I receive compilation error but in Borland C++ all ok. What is problem? #include<iostream.h> #include<stdlib.h> #include<string.h> void main() { unsigned long N, K, i, position; char * mas[30000]; char * mas1[30000]; char * mas2[30000]; char * mas3[10000]; cin>>N; cin>>K; for( i = 1 ; i <= N; i++) { if(i < 30000) { ultoa(i, mas[i - 1], 10/* size(i)*/); } else if (i < 60000) { ultoa(i, mas1[i - 30001] , 10/* size(i)*/); } else if (i < 90000) { ultoa(i, mas2[i - 60001] , 10/*size(i)*/); } else if (i < 100000) { ultoa(i, mas3[i - 90001] , 10/*size(i)*/); } } i = 0; position = 0; int step = 0; while( i < N) { while(step < K) { if(position >= N) position = position - N; if(position < 30000) { if(strcmp(mas[position], "0") != 0) step ++; } else if(position < 60000) { if(strcmp(mas[position - 30000], "0") != 0) step ++; } else if(position < 90000) { if(strcmp(mas[position - 60000], "0") != 0) step ++; } else if(position < 100000) { if(strcmp(mas[position - 90000], "0") != 0) step ++; } position++; } step = 0; position --; if(position < 30000) { cout<<mas[position]; mas[position] = "0"; } else if(position < 60000) { cout<<mas1[position]; mas1[position] = "0"; } else if(position < 90000) { cout<<mas2[position]; mas2[position] = "0"; } else if(position < 100000) { cout<<mas3[position]; mas3[position] = "0"; } cout<<" "; i++; position ++; } } |
| Here my solution | yaho0o0 | 1457. Heating Main | 8 Apr 2009 12:57 | 3 |
#include <iostream> #include <stdio.h> using namespace std; int main() { int i,n,a; double o=0; cin>>n; for(i=1;i<=n;i++) { cin>>a; o+=a; } o/=n; fprintf(stdout,"%.6lf ",o); cout<<endl; return 0; } Edited by author 07.04.2009 21:17 Edited by author 08.04.2009 12:58 |
| English version bug in viewing source | I&K | | 8 Apr 2009 12:20 | 1 |
In English version of the site, the page offering to enter JUDGE_ID and password when viewing source has a button with Russian caption - "Продолжить" |
| Connecting carriages | Angelwarrior | 1276. Train | 7 Apr 2009 21:50 | 1 |
Simple questiong :D I just can't get it, how should we connect carriages? If we have "AA" "BA" "AB" what can we connect "AABA" or "AAAB"??? |
| here is my solution I've got AC 0,015 209kb | yaho0o0 | 1581. Teamwork | 7 Apr 2009 21:03 | 1 |
#include <iostream> using namespace std; int main() { int n,a[1024],br=1,i; cin>>n; cin>>a[1]; if(n==1) { cout<<"1 "<<a[1]; } for(i=2;i<=n;i++) { cin>>a[i]; if(a[i]==a[i-1]) { br++; } if(a[i]!=a[i-1]) { cout<<br<<" "<<a[i-1]<<" "; br=1; } if(i==n) { cout<<br<<" "<<a[i]; } } cout<<endl; return 0; } Edited by author 07.04.2009 21:12 |
| WA2 Help! | Rabidstorm | 1078. Segments | 7 Apr 2009 19:30 | 1 |
program Ural1078; var ok:array[1..500,1..500]of boolean; x,y,ans:array[1..500]of longint; a,b,n,max:longint; function dfs(o,l:longint):boolean; var i:longint; u:boolean; begin u:=false; for i:=1 to n do if ok[o,i] then u:=u or dfs(i,l+1); if max<l then begin max:=l; u:=true; end; if u then ans[l]:=o; exit(u); end; begin readln(n); fillchar(ok,sizeof(ok),false); for a:=1 to n do readln(x[a],y[a]); for a:=1 to n do for b:=1 to n do if (x[a]<=x[b])and(y[b]<y[a]) then ok[a,b]:=true; max:=0; for a:=1 to n do if dfs(a,1) then ans[1]:=a; writeln(max); for a:=max downto 1 do write(ans[a],' '); end. What is wrong??? |
| Am I wrong?Please give me some test. | yuyan | 1687. Numismatics for Fun | 7 Apr 2009 11:55 | 1 |
I use greedy to solve this problem. First,I scanned all the boxes.If it had N new different coins that Tom wanted.The purchase will added about N*100 Then,I think Tom would buy this box.And it costs him 100 yen. At last.If the purchase>0 ,then I would buy some boxes that Tom did not have been bought. I was WA on #1 Am I wrong? At last,I'm sorry for my poor English. Thanks a lot. |