| Show all threads Hide all threads Show all messages Hide all messages |
| No subject | Alex Fetisov | 1643. Attack of the Dark Fortress | 13 Dec 2013 21:39 | 3 |
Good tricky problem Edited by author 05.12.2012 05:22 |
| No subject | svg2003 | 1206. Sum of Digits of the Sum of Numbers | 13 Dec 2013 11:25 | 1 |
Edited by author 13.12.2013 11:36 Edited by author 13.12.2013 11:36 |
| One doubt: After re-learn Ci Pj | gautamvs | 1992. CVS | 13 Dec 2013 00:49 | 1 |
Does Pj becomes last program learned for clone Ci even if Pj was first learned program for clone Ci ? |
| Why not L=K-1 | Kolio | 1023. Buttons | 13 Dec 2013 00:07 | 4 |
Can someone tell me what's wrong with this program? #include <stdio.h> int main(void) { int n; scanf("%d", &n); printf("%d\n", n-1); return 0; } |
| What is the test №3 | kutenin | 1818. Fair Fishermen | 12 Dec 2013 19:29 | 9 |
i have problems with test №3 Please help try test: 2000 then 1999 of "0" and 1 of "1" Or just test: 3 0 0 0 (the statement says there is at least 1 caught fish, but most solutions print 0) What is wrong with my code ? Am i using a wrong algo ? /*1818.cpp*/ #include<iostream> #include<string> #include<string.h> #define MAXN 2000 #define MAXNCHAR 4 using namespace std; string sum(const string &a,const string &b) { string res=""; unsigned carry=0, nA=a.size(), nB=b.size(); while(nA>0 && nB>0) { res.insert(res.begin(),(a[nA-1]-'0'+b[nB-1]-'0'+carry)%10+'0'); carry=(a[nA-1]-'0'+b[nB-1]-'0'+carry)/10; nA--; nB--; } while(nA>0) { res.insert(res.begin(),(a[nA-1]-'0'+carry)%10+'0'); carry=(a[nA-1]-'0'+carry)/10; nA--; } while(nB>0) { res.insert(res.begin(),(b[nB-1]-'0'+carry)%10+'0'); carry=(b[nB-1]-'0'+carry)/10; nB--; } if(carry>0) res.insert(res.begin(),carry+'0'); return res; } string mult1(const string &a,char b) { string res=""; unsigned i,nA=a.size(), carry=0; if(b=='0') { res="0"; return res; } for(i=0;i<nA;i++) { res.insert(res.begin(),((a[nA-1-i]-'0')*(b-'0')+carry)%10+'0'); carry=((a[nA-1-i]-'0')*(b-'0')+carry)/10; } while(carry>0) { res.insert(res.begin(),carry%10+'0'); carry/=10; } return res; } string mult(const string &a,const string &b) { unsigned i,j,nB=b.size(); string tmp,res="0"; for(i=0;i<nB;i++) { tmp=mult1(a,b[nB-1-i]); for(j=0;j<i;j++) tmp.insert(tmp.end(),'0'); res=sum(res,tmp); } return res; } string x,arr[MAXN]; char l=1; unsigned n; void read() { unsigned i; char nChar[MAXNCHAR+1]; cin>>n; for(i=0;i<n;i++) { cin>>arr[i]; l=l && arr[i]=="0"; } sprintf(nChar,"%u",n); x.assign(nChar); } string solve() { string res; unsigned i; if(l==0) { res=arr[n-1]; for(i=1;i<n;i++) { res=mult(res,x); res=sum(res,arr[n-1-i]); } return res; } res=x; for(i=1;i<n;i++) res=mult(res,x); return res; } void write() { cout<<solve()<<endl; } int main() { read(); write(); return 0; } Edited by author 08.02.2011 01:51 Edited by author 08.02.2011 01:52 Edited by author 10.02.2011 16:32 Is output for that case : 2000 1999 of '0' and one '1' http://pastebin.com/WfrYZTAg ? Edited by author 01.05.2011 21:02 Edited by author 01.05.2011 21:02the output for 3 0 0 0 is 9 or 0 ? I've got WA on #3 and for 3 0 0 1 is 9 too? I haven't solved it yet. It's WA3 too. But I think the correct answer for 3 0 0 0 is 27. and for 3 0 0 1 is 9. Edited by author 05.05.2011 04:30 Edited by author 05.05.2011 04:30 What the output for 2000 1999 of '0' and one '1' Can u give the answer of this test? |
| Could you look at 1353 example, please | vito | | 12 Dec 2013 12:21 | 1 |
|
| Log for Runtime error for solution ID 5400689 | vito | | 12 Dec 2013 11:18 | 1 |
Hello. May I get log or at least description for this error. |
| Its solution | gnaggnoyil | 1698. Square Country 5 | 12 Dec 2013 11:04 | 5 |
The Easy Number is in fact the Automorphic Number. And a number is a Automorphic Number when and only when it is the suffix of another Automorphic Number. So, I download a program to make the Automorphic Number of 2000 dights. And... Edited by author 14.03.2009 22:51 Edited by author 14.03.2009 22:51 Edited by author 14.03.2009 22:51 It is evident. But how to implement this without long arithmetic. My solution uses Java.BigInteger and reccurence: k^2*10^2*L+k*(2*A-1)*10^L+Z*10^L=Z1*10^L1; where A*A-A=Z*10^L and A1=k*10^L+A- new value where A1*A1-A1=Z1*10^L1, L1>=L+1 |
| GIVE ME SOME TEST PLEASE!!!!!!! | WuLF | 1430. Crime and Punishment | 12 Dec 2013 08:52 | 2 |
Who solved it. GIVE ME SOME TEST PLEASE!!!!!!! GIVE ME SOME TEST PLEASE!!!!! |
| Fails with WA @ Test Case 7 | thefourtheye | 1837. Isenbaev's Number | 12 Dec 2013 08:10 | 2 |
I think we are missing something which is quite common in this case. http://ideone.com/XHozKe Can someone throw some ideas, why this fails at test case 7? ___Test 13 Fominykh Isenbaev BBB BBB CCC AAA Ayzenshteyn Oparin Samsonov Ayzenshteyn Chevdar Samsonov Dublennykh Fominykh Ivankov Burmistrov Dublennykh Kurpilyanskiy Cormen Leiserson Rivest Oparin AA AAA Isenbaev Oparin Toropov AA DD PP PP QQ RR RR SS TT TT Toropov Oparin ____correct answer: AA 2 AAA 2 Ayzenshteyn 2 BBB 1 Burmistrov 3 CCC 2 Chevdar 3 Cormen undefined DD 3 Dublennykh 2 Fominykh 1 Isenbaev 0 Ivankov 2 Kurpilyanskiy 3 Leiserson undefined Oparin 1 PP 3 QQ 4 RR 3 Rivest undefined SS 3 Samsonov 2 TT 2 Toropov 1 |
| What is the test case 10 ??? | Nayeem Reza | 1224. Spiral | 12 Dec 2013 02:53 | 1 |
#include<cstdio> #include<cstring> #include<cassert> #include<vector> #include<list> #include<queue> #include<map> #include<set> #include<deque> #include<stack> #include<bitset> #include<algorithm> #include<functional> #include<numeric> #include<utility> #include<sstream> #include<iostream> #include<iomanip> #include<cmath> #include<cstdlib> #include<ctime> #include<fstream> #include<typeinfo> #include<locale> #include<iterator> #include<valarray> #include<complex> using namespace std; int main() { int n,m; while(cin>>n>>m){ int sum = 0,flag = 0,count = -1,x=n*m; n--; if(n==0 || m==0){ cout<<"0"<<endl; continue; } while(sum < x){ if(flag==0){ sum += m; flag = 1; m--; } else if(flag==1){ sum += n; flag = 0; n--; } count++; } cout<<count<<endl; } return 0; } here is my code, it has got verdict WA in test case 10.... |
| Why? | Mihanaz | 1225. Flags | 12 Dec 2013 01:54 | 2 |
Why? Mihanaz 22 Aug 2013 11:22 Why, if one of the strip, the answer is 2? "Red" and "Red"? If n = 1, then the only strip may be Red or White, so answer is 2. If n = 2, then you can either start with Red or White, but for each, you can only place White or Red respectively for the second strip, so answer is 2 again. |
| largest known mersenne primes | jk_qq | 1352. Mersenne Primes | 12 Dec 2013 01:29 | 1 |
The largest known prime number is currently the Mersenne prime 2^{57,885,161} - 1. Discovered January, 2013. Edited by author 12.12.2013 01:30 |
| WA4 | d3m0n1c | 2001. Mathematicians and Berries | 12 Dec 2013 00:26 | 3 |
WA4 d3m0n1c 11 Dec 2013 18:58 please give me a test for WA4. According to my current logic result should be (filled bucket weight - empty bucket weight) for each mathematician. Edited by author 11.12.2013 19:12 Re: WA4 Vladimir Shevchuk 12 Dec 2013 00:01 Try this test: 7 5 9 3 4 8 Answer: 3 2 |
| Please explain the test case | Shafaet | 1643. Attack of the Dark Fortress | 11 Dec 2013 22:26 | 3 |
How can gelu's army reach the castle in 11 days?? |
| output size??? | Igor Mihajlovic | 1453. Queen | 11 Dec 2013 21:18 | 2 |
what is the limit for output size it could be very big for n=10000 and s=100000 and if the coordinates is in center of hypercube then there is (s-1)*2^(n-1) by bishop and n*(s-1) by rock squares that queen can move how the hell should i output this?? or am i wrong??? plz help ASAP!!! Edited by author 21.08.2008 07:36 Edited by author 21.08.2008 07:36 you can use BigInteger class in java, which calculates the numbers of any sizes... |
| WA_1:( guys, im trying to solve it for ages, please give me any advice... | BORODA | 1102. Strange Dialog | 10 Dec 2013 21:11 | 1 |
I read 3 chars and run the follow DFA: one on in/out put lost: empty: in/out: input/output: put: here is my code: #include <iostream> #include <cstdio> #include <cassert> #include <cstdlib> #include <string> using namespace std; inline bool good(char C) { return (C >= 'a' && C <= 'z'); } int a[5][4] = {{0, 0, 0, 0}, {1, 0, 2, 4}, {1, 0, 2, 3}, {1, 1, 2, 4}, {0, 1, 0, 0}}; char c[3]; bool get_ans() { int n_u = 0, pos = 1; if (!good(c[2])) { return (c[0] == 'i' && c[1] == 'n'); } bool n2 = 0; while (true) { if (pos == 0) return 0; if (n2) return (pos != 0 && pos != 4); c[0] = c[n_u % 3]; for (int i = 3 - n_u; i < 3; i++) { c[i] = getc(stdin); if (!good(c[i])) { if (i == 0) return (pos != 0 && pos != 4); if (i == 1) return 0; n2 = 1; break; } } if (!n2 && c[0] == 'o' && c[1] == 'n' && c[2] == 'e') { pos = a[pos][0]; n_u = 3; continue; } if (c[0] == 'o' && c[1] == 'n') { pos = a[pos][1]; n_u = 2; continue; } if (!n2 && c[0] == 'o' && c[1] == 'u' && c[2] == 't') { pos = a[pos][2]; n_u = 3; continue; } if (c[0] == 'i' && c[1] == 'n') { pos = a[pos][2]; n_u = 2; continue; } if (!n2 && c[0] == 'p' && c[1] == 'u' && c[2] == 't') { pos = a[pos][3]; n_u = 3; continue; } return 0; } } int main() { // assert(freopen("inp.in", "r", stdin) != NULL); int n; assert(scanf("%d", &n) == 1); c[0] = getc(stdin); for (int i = 0; i < n; i++) { bool ok = 0; c[0] = getc(stdin); if (good(c[0])) { c[1] = getc(stdin); if (good(c[1])) { c[2] = getc(stdin); ok = get_ans(); } else { ok = 0; } } if (ok) printf("YES\n"); else printf("NO\n"); } } Edited by author 10.12.2013 21:13 Edited by author 10.12.2013 21:15 Edited by author 10.12.2013 21:22 |
| If you have WA #4 | Smilodon_am [Obninsk INPE] | 1900. Brainwashing Device | 10 Dec 2013 17:08 | 1 |
If you have WA #4 try this simple test: 3 2 1 5 10 answer is of course 16 1 2 |
| 12 test WA | Лерник Казарян [RAU] | 2011. Long Statement | 10 Dec 2013 12:48 | 3 |
|
| OH my god!!!!! Use vc++2010 or g++4.7.2 instead of G++4.7.2c++11 | Pegasus | 1915. Titan Ruins: Reconstruction of Bygones | 10 Dec 2013 08:17 | 3 |
When I use G++11 I always get TLE,but once I try vc++2010 to submit my code , I got AC. I wasted too much time.Any can expalin it for me ? This is my code:#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> const int MAXN = 1000000 + 10; int a[2 * MAXN]; using namespace std; int main() { int n; scanf("%d", &n); int i = 1; while (n--) { int t; scanf("%d", &t); if (t > 0) a[i++] = t; else if (t == -1) printf("%d\n", a[--i]); else if (t == 0) { if (i - 1 <= n) { int num = min(i - 1, n); for (int j = 1; j <= num; ++j) { a[i] = a[i-num]; ++i; } } } } //system("pause"); return 0; } Edited by author 26.04.2013 15:20 MY LIFE WILL NEVER BE THE SAME! How does it works? could anybody explain it? Apparently, printf is painfully slow in C++11 for some reason. I was having the same issue while trying to submit problem #1976 (where answer consists of up to 1000000 integers) and ended up implementing manual output via putchar. Now i know a simple change of language would've worked as well. Edited by author 10.12.2013 08:17 |