Common Board| Show all threads Hide all threads Show all messages Hide all messages | | 16 тест | tideee | 1723. Sandro's Book | 19 Aug 2016 01:37 | 2 | помогите, что в нём?!?! спасибо, за помощь ) так. с 16-м разобрался, но что же на 28 ? | | G++ 4.9 Where is compilation error?/ Где ошибка компиляции? | Vadim | 1001. Reverse Root | 19 Aug 2016 01:05 | 2 | #include <iostream> #include <math.h> #include <algorithm> #include <vector> using namespace std; int main() { vector<long long int>v; long long int b; while (cin >> b) v.push_back(b); reverse(v.begin(),v.end()); for (long long int k: v) cout << fixed << sqrt(k) << "\n"; return 0; } | | To admins | graf-m | 1380. Ostap's Chess | 18 Aug 2016 05:14 | 1 | The problem's author did not write that, after the last move you need to print out a position, but it follows from the third example and tests Please add this condition | | Test #5 | DarkSun1997 | 1796. Amusement Park | 18 Aug 2016 03:27 | 1 | Test #5 DarkSun1997 18 Aug 2016 03:27 | | Test #8 | Igor Gomes | 1014. Product of Digits | 17 Aug 2016 21:24 | 28 | Test #8 Igor Gomes 8 Oct 2004 10:55 My code is ok all tests before #8, but I've WA on #8... Anything that I don't see? Thanks Can anyone help me? I have the same problem and I know the code is ok, I checked it 100 times Edited by author 29.07.2005 01:06 I also had WA on test#8(now I have AC). I don't know this test, but look: N = 362880 Right Q is 2578899. You see: all numbers(digits)in Q must be sorted: 2<=5<=7<=8<=8<=9<=9 - it's condition for minimal Q, but you must surch begining from 9
in my program the digits are sorted. for your example my answer is also 2578899 correct answer for 0 is 10. maybe this fact help you. my God..my alog is WRONG. thx! Edited by author 02.10.2011 20:48 May be this helps. If input is 12 output should be 26 not 34 . It is something strange... My program outputs 10, when input is 0, in your examples: 12 -> 26, not 34, but I have WA#8, why????? Program is correct, maybe tests are wrong??? Yes i am having the exact same problem... considered all test cases and am getting the write answers in ascending order but test#8 is giving WA Edited by author 03.12.2005 18:23 Edited by author 03.12.2005 18:23 I think tests are OK. If you still need some help send me your code to sk1@hotbox.ru I have this problem too!!! All test, what i see is correct; I use unsigned long; May be it consist false; What I doing wrong? Edited by author 05.04.2006 14:23 test Edited by author 04.07.2006 19:44 my solution in c++ 0.031 s. #include<iostream> #include<cmath> #include<string> #include<algorithm> using namespace std; inline bool isprime(long a) { if(a==1)return false; if(a==2)return true; if(a%2==0)return false; for(int i=3;i<sqrt(a);i+=2) { if(a%i==0)return false; } return true; } int main() { string a; long n; int d=1; cin>>n; if(n==0)cout<<"10"<<endl; else if(n==1)cout<<"1"<<endl; else{ if(isprime(n) && n>10)d=0; else { int gamyop=9; while(n!=1) { if(n%gamyop==0) { a+=(gamyop+'0'); n/=gamyop; if(isprime(n) && n>10){d=0;break;} } else { gamyop--; } } } sort(a.begin(),a.end()); if(d==1)cout<<a<<endl; else cout<<"-1"<<endl; } return 0; } I have this problem too!!! All test, what i see is correct; I use unsigned long; May be it consist false; What I doing wrong? Edited by author 05.04.2006 14:23 try string,or int64 if I using __int64 I have overflow too. In this problem must use only string for result. I used recursive algorithm. (C++) result and local variables in function must be __int64(long long) In other cases you'll get an overflow Usage of string not are obligatory Test#8 is: N=1 000 000 000 Q->555555555888 for examle with local or result variables of type unsigned you'll get Q->1504774704 Sorry for my English :) Re: Test #8 Shu Konstantin Preslavski 22 Apr 2010 04:46 I don't know if what is exactlly the test but the answer is something like -1 or 26 ;D It works for me there after fixing that... ;) Yep... problem in java was using int instead of long. Yep... problem in java was using int instead of long. I have Q->555555555888 when N=1 000 000 000, but Test#8 say "WA". Why? thanks mate. I was getting wrong for this reason. Those who are getting WA at Test #8. try to use "Unsigned long long int" insted of "int". | | WA 10 | Combatcook | 1759. Long-Livers | 17 Aug 2016 18:40 | 1 | WA 10 Combatcook 17 Aug 2016 18:40 No subject Edited by author 13.12.2017 23:34 | | This problem involves number theory??? | Miguel Angel | 1141. RSA Attack | 17 Aug 2016 14:40 | 5 | This problem involves number theory??? > This problem involves number theory??? yes, you can refer to chapter 33 of Introduction to Algorithms, MIT Press, there covers enough knowledge you need to solve the problem. suppose d is multiplicative inverse of e, modulo (p - 1)(q - 1), where p * q = n then the answer should be c^d (mod n) > > This problem involves number theory??? > > yes, you can refer to chapter 33 of Introduction to Algorithms, > MIT Press, there covers enough knowledge you need to solve the > problem. > > suppose d is multiplicative inverse of e, modulo (p - 1)(q - 1), > where p * q = n > > then the answer should be c^d (mod n) Но ведь ответ не всегда верен! Контрпример: e=3 n=15 (p=3,q=5) c=3 GCD(e,(p-1)(q-1))=GCD(3,8)=1 e<(p-1)(q-1) e*d=1 modulo (2*4) => d=3 m=c^d (modulo n)=3^3 mod (15)=(15+12) modulo (15)=12 (modulo 15) != 3 modulo (15)=c modulo (15) Проблема возникает в случае GCD(c,n)>1 (p or q (if pq then c=0 mod (n))). Автор забыл упомянуть, что GCD(c,n)=1 или мне повезло с АС? Edited by author 17.08.2016 14:41 | | Whats wrong c++? | Vadim | 1787. Turn for MEGA | 16 Aug 2016 21:13 | 2 | #include <iostream> using namespace std; int main() { int k; cin >> k; int n; cin >> n; int change; int result = 0; for (int i = 0; i < n; i++) { cin >> change; result += change; } if (result - k*n >= 0) cout << result - k*n; else cout << 0; return 0; } Author's behavior. 1) You should explain what problem is - WA/TLE/runtime error. 2) You should better remove/clear/add explanation to post after you solved task yourself. Edited by author 16.08.2016 21:18 | | Why this code get WA? | Felix_Mate | 1487. Chinese Football | 16 Aug 2016 16:21 | 1 | Насколько я понял, есть орграф без циклов, при этом если из вершины v1 можно попасть в v2, из v2 в v3, то и из v1 можно попасть в v3 (дуга моделирует победу). Команда v1 лучше v2, если нет u, отличной от v1 и v2/ из u можно попасть в v1 и v2. Код с WA2: #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> const int nmax = 1005; bool a[nmax][nmax]; int d[nmax], p[nmax]; //d[v]=0,если нет входящих дуг в v, p[v]-вершина u/ v достижима из u и d[v]=0. bool used[nmax]; char ch; int n, q, v, u; void DFS(int v, int par); void main() { scanf("%d\n", &n); for (int i = 1; i <= n; i++) { d[i] = 0; used[i] = false; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { scanf("%c", &ch); if (ch == '0') a[i][j] = 0; else a[i][j] = 1; d[j]+=a[i][j]; if (j == n) scanf("\n"); } } for (int i = 1; i <= n; i++) { if (d[i] == 0) { p[i] = i; DFS(i, i); } }
scanf("%d\n", &q); for (int i = 1; i <= q; i++) { scanf("%d %d\n", &v, &u); if ((d[v] > 0) && (d[u] > 0) && (p[v] == p[u])) printf("No\n"); else printf("YES\n"); } } void DFS(int v, int par) { used[v] = true; for (int i = 1; i <= n; i++) { if ((!used[i]) && (a[v][i] == 1)) { p[i] = par; DFS(i, par); } } } Ошибка была в том, что из несколько вершин, не имеющих входные дуги, можно попасть в некоторую вершину. Edited by author 03.01.2017 22:31 | | 11 10 34, 11 10 33, 11 5 100 | esbybb | 1995. Illegal spices | 16 Aug 2016 04:06 | 2 | 31 1 2 2 3 3 3 3 3 3 4 4 28 1 2 2 2 3 3 3 3 3 3 3 26 1 1 1 1 1 1 2 3 4 5 6 Edited by author 16.08.2016 04:04 11 5 50 16 1 1 1 1 1 1 2 2 2 2 2 11 5 75 18 1 1 1 1 1 1 2 2 2 3 3 | | Solution | Roland | 1731. Dill | 16 Aug 2016 00:44 | 13 | Very easy:) just print numbers 1,2,...,n then n+1,2*n+1,...,m*n+1 Sorry,can you explain why... Thank you. because if you take any 2 numbers(a1,a2) from the 2 line and any 2 numbers(b1,b2) from the 3 line, a1+b1!=a2+b2 and a1+b2!=a2+b1... or 1, 2, 3, ... n 100, 200, 300, m*100 :) Can someone explain me why following solution incorrect? 1,2,3,..,n n, 2*n+1, 3*n+2, .. m*n+m-1 I got WA#1 with it. cause you have n twice Can someone explain me why following solution incorrect? 1,2,3,..,n n, 2*n+1, 3*n+2, .. m*n+m-1 I got WA#1 with it. _ Edited by author 20.04.2010 00:42 I had done as you saggest and after my program was crashed on 6 test. What it means? And what me do now? Please help, because it very importent for me. Thank you for advance! Very easy:) just print numbers 1,2,...,n then n+1,2*n+1,...,m*n+1 Everithing is done! Sorry for my mindless please. You may write random numbers and get AC@) it's not true. random numbers can't be always true. In fact sometimes random numbers can be equal.in statement is's written that equal numbers should not be. And even if won't be equals is possible to catch WA. Sorry for bad Englis.:) Excuse me again. I would like to know from what thinking I can gone to this solution. Because I must to explain my teacher why this variant of solution is correct.Please explain me how to gone to such solution logically or vhere I can read about it. Thank you for advance! Very easy:) just print numbers 1,2,...,n then n+1,2*n+1,...,m*n+1 | | Why so? | →MOPDOBOPOT← | 1731. Dill | 16 Aug 2016 00:37 | 3 | Why so? →MOPDOBOPOT← 17 Jan 2010 12:44 input: 2 3 Output: 1 2 3 5 7 Why this result failed 1 test? Why did you decide that the first test is this? | | AC, but... | Burunduk1 | 1432. Twofold Luck | 15 Aug 2016 20:10 | 5 | If anybody knows O(n) solution, please, send it to sk1@hotbox.ru PS: My solution is O(n^2) Can you tell me your O(n^2) solution? My email: compileme@gmail.com Thank you:) Could you tell me your O(N^2) algorithm? Thanks. My email is temptempttt@126.com Could you tell me your O(N^2) algorithm? Thanks. my e-mail kostan3@spaces.ru | | WA8 | Ivan11Start | 2089. Experienced coach | 15 Aug 2016 16:30 | 3 | WA8 Ivan11Start 19 Jun 2016 21:45 I don't understand my mistake. Please, give me some tests to solve this problem. Re: WA8 Combatcook 20 Jun 2016 21:06 Maybe these tests will help you: 4 4 1 2 3 4 2 1 1 2 ans: No 8 9 1 2 1 3 1 4 5 6 7 2 7 3 7 4 8 9 ans: No 14 14 1 2 5 4 4 3 2 3 2 6 6 7 13 8 12 11 11 10 10 9 9 8 7 8 7 14 14 6 Answer: Yes 1 5 4 3 2 6 13 12 11 10 9 8 7 14 | | Can anybody explain? I was reciving WA3 but after revercing my output data I get AC. Why? | Виталий Черков | 1176. Hyperchannels | 15 Aug 2016 03:19 | 3 | Because the edges are directed Try this test 5 2 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 | | How to solve this problem without cheating? | Yaroslavtsev Grigory (SpbSPU) | 1352. Mersenne Primes | 13 Aug 2016 19:28 | 11 | Should I use some test of simplicity (from Cormen or somewhere else) or is there any better way for such numbers? If someone knows how to solve this proble without cheatin' (if carefull reading of the definition is a cheat) then he can get a lot of money... :) Sorry, I understood after all, as for me I just found all the numbers in the Internet:) Of course, you cannot solve it without "cheating". The most powerful tests work for months to test one number! You already have all numbers written in the text - why do you think it is cheating? And it's easy to find the rest - up to 7-th. It's enough to test all numbers 2^p-1 up to 2^30-1 (only 30 numbers!) using bruteforce. I don't think it is possible to solve it without cheating, otherwise, why now the largest one is only 43th? Any way, you can get most of the ans in the text, except 3~8... -~+~- AzuReVaPouR 28 Apr 2005 18:22 its just impossible to calculate it in 1 second. If using Wikipedia and OEIS aren't cheating I know how to do it) If using Wikipedia and OEIS aren't cheating I know how to do it) Using Wikipedia and OEIS may be cheating, but using the answers already in the problem definition definitely isn't. | | Enter here if you have WA#12 | GastonFontenla | 1224. Spiral | 13 Aug 2016 15:37 | 2 | Test 12 is overflow case. Be careful with data type. It is so strange! If I use int for N and M, I get WA in test 12. If I use long, it is OK. But 2^31 - 1 (the max value of N, M) is normal for int. So I think the test 12 uses numbers larger than 2^31 - 1. | | What is the blank line? | btas | 1050. Preparing an Article | 13 Aug 2016 14:59 | 6 | Hi "Paragraph ends in the source text are marked either by at least one blank line, or a \par command or both." What is the blank line? '\n'? Or some space symbol which ends with '\n'? Edited by author 13.08.2016 00:25 Edited by author 13.08.2016 00:26 Blank line is the 3rd line in example input, no spaces or other symbols. I suppose you're confused by looking at the input after highlighting it, but there are really no spaces there, it's just highlighting works that way. But how can I detect it in C++? I tried '\n', '\r' and "\n\r\r" but i have WA#3 :( I had WA3 because i forgot that after \endinput (not only after \par or blank line) i should check if there's an extra quote to be removed in that paragraph. Maybe that will help you. As about your question, i'm not really good at C++, but maybe i can suggest http://linux.die.net/man/3/getline or something. And if that line is of length 0, then it's blank. | | WA Test #9 | baske | 2062. Ambitious Experiment | 13 Aug 2016 03:36 | 3 | Can any one help me? I got WA in test #9. But I have no idea where I made a mistake. I need some tests. I might ignored something important. Thanks. me too,got WA in test #9. Have you solve it? | | Условие) | Akula | 2005. Taxi for Programmers | 12 Aug 2016 23:39 | 2 | С чего это Илья не хочет быть отвезен последним?) Боится остаться с дядей Мишей наедине :D:D На перекрестке Крауля-Токарей развязка неудобная, а Илья беспокоится о тренере |
|
|