Common Board| Show all threads Hide all threads Show all messages Hide all messages | | It's a waste of time! | Celebrate | 1220. Stacks | 24 May 2021 18:43 | 1 | I spent 3 hours on it.But I find it is expected to use "short" at last!!! | | Why I get WA at test 10 | Walker | 1977. Energy Wall | 24 May 2021 17:14 | 1 | I use Segment tree.I can't find anything wrong in my code.Why? | | Help | Liu Qi | 1557. Network Attack | 23 May 2021 01:19 | 2 | Help Liu Qi 9 Jan 2010 06:04 I always get a wrong answer on test 11,who can help me? Re: Help Maydell Anton 23 May 2021 01:19 This small test helped me to move from WA on test 11 to AC. 3 4 3 2 1 3 2 1 1 2 ans: 1 | | Помигите понять ошибки | Romanchillihotpepper | 1910. Titan Ruins: Hidden Entrance | 22 May 2021 16:54 | 2 | #include<iostream> int main() { int32_t a,c=0,c1=0,d=0; std::cin>>a; int32_t b[a]; for(int g=0;g<a;g++){ std::cin>>b[g]; } for(int g=1;g<a-1;g++){ c=b[g-1]+b[g]+b[g+1]; if(c>c1) {c1=c;d=g+1;} } std::cout<<c1<<" "<<d; } У меня код не выдает ошибок на моем Кодеблоке, тут же выдает следующее: solution(6): error C2131: expression did not evaluate to a constant solution(6): note: failure was caused by a read of a variable outside its lifetime solution(6): note: see usage of 'a' solution(8): warning C4552: '>>': result of expression not used Дело в том, что запись "int32_t b[a];" не стоит использовать, когда в квадратных скобках стоит переменная, которая вводится с клавиатуры (не является константой). Для этого нужно использовать запись "int32_t* b= new int32_t [a];", попробуйте заменить в шестой строке. | | Found funny formula solution :-) | LuckyCat | 1197. Lonesome Knight | 21 May 2021 06:40 | 2 | #include <iostream> using namespace std; int main() { int count; cin >> count; while (count--) { char x, y; cin >> x >> y; float a = (x - 'a') - 3.5; float b = (y - '1') - 3.5; cout << trunc(1.143 * trunc(1.2 * (6 - trunc((a * a + b * b) * 0.2f)))) << endl; } } #include <iostream> using namespace std; int main() { int count; cin >> count; while (count--) { char x, y; cin >> x >> y; float a = abs(abs((x - 'a') - 3.5) - 1.0) - 0.5; float b = abs(abs((y - '1') - 3.5) - 1.0) - 0.5; cout << trunc(1.143 * trunc(1.2 * (6-a-b))) << endl; } } | | It seem like that the lenth of the words is greater than 15? | zwqzwq | 1542. Autocompletion | 21 May 2021 04:34 | 2 | I set the length of my array to 15 then got WA at #14 while I set16 then I got AC But I dont know why,could anyone help me? | | WA #23 try this | Ivan Zakharov | 1772. Ski-Trails for Robots | 18 May 2021 18:40 | 2 | 10 4 2 1 2 8 10 answer: 0 11 6 3 1 2 10 11 5 7 answer: 2 Edited by author 06.03.2021 15:54 | | if you get wa, try this test, maybe will help you | Huang WenHao | 1156. Two Rounds | 18 May 2021 17:40 | 4 | Test: 6 5 1 2 4 3 2 9 2 4 4 1 Ans: IMPOSSIBLE Thank you very mutch!!! It's very helpfull if somebody get WA7. (We just cann't paint this graph on 2 colors. ) A very good test, thanks. I had WA7 and now I have AC, using this one | | Test with maximum L N | Zergatul | 1598. DSA Attack | 17 May 2021 20:04 | 1 | 36 60 60238766947 689134144379425669 151303190236896619 105037406971508485 68317121395 x=6221392564 | | why this solution is wrong? | Gleb | 1409. Two Gangsters | 16 May 2021 03:02 | 3 | #include<iostream> using namespace std; int main() { int a; int b; int c; int d; int h; cin>>a; cin>>b; h=a-1+b; c=h-a; d=h-b; cout<<c; cout<<d; return 0; } You should test your code locally before submitting, this way you will notice that you missed a space! I've simplified your way. use the following, you'll get the result - c = b - 1; d = a - 1; cout<<c<<" "<<d; Edited by author 16.05.2021 03:02 | | Why WA3? | Personal Data | 2157. Skydiving | 15 May 2021 05:45 | 1 | Why WA3? Personal Data 15 May 2021 05:45 | | C++ - how to value (a*b)%c, when a,b,c are long long? | ToadMonster | 1013. K-based Numbers. Version 3 | 14 May 2021 21:33 | 4 | long long mul(long long a,long long n) { long long ret; if(n==0) return 0; ret=mul(a,n/2); ret=(ret+ret)%mod; if(n%2) ret=(ret+a)%mod; return ret; } Edited by author 24.11.2016 05:02 LL product_mod(LL a, LL b, LL mod) { a %= mod; b %= mod; LL result = 0, y = a; while(b) { if(b&1) result = ((result%mod) + y) %mod; y = (y + y)%mod; b = b >> 1; } return result%mod; } This is also known as the Russian peasant method for multiplication. For example, 7x13 13 = (8 + 4 + 1) The product is re-written as 8.7 + 4.7. 1.7 In my code, y keeps track of 7, 2.7. 4.7, 8.7, etc. It gets added to result whenever a bit is set in b. long long c = (__int128_t)a*b%md; he he) Edited by author 14.05.2021 21:34 Edited by author 14.05.2021 21:34 | | Please give me some tests.Thank in advance!!!! | Search | 1073. Square Country | 13 May 2021 16:11 | 2 | I don't understand problem,please give me some tests.Thank!!!!!! Here are some tests ~~~~~~~~~~~~ 11995=3 11996=4 11997=3 11998=3 11999=4 12000=3 12001=3 12002=2 12003=3 ~~~~~~~~~~~~~~ 23402=2 23403=3 23404=3 23405=3 23406=3 23407=4 23408=4 23409=1 23410=2 23411=3 ~~~~~~~~~~~~~~ 59989=3 59990=3 59991=4 59992=3 59993=2 59994=3 59995=3 59996=4 59997=3 59998=3 59999=4 60000=3 | | Hint | yyll | 1172. Ship Routes | 13 May 2021 12:53 | 1 | Hint yyll 13 May 2021 12:53 let there be 2k odd gaps and n-2k even gaps between island A even gaps could be BCBCBC or CBCBCB odd gaps are half BCB half CBC | | WA3 | Zergatul | 2101. Knight's Shield | 12 May 2021 01:10 | 2 | WA3 Zergatul 28 Nov 2020 02:48 Try this test: =========================== -10 -10 10 5 5 10 0 0 --- 42.8571428571 5 | | OEIS A259935 | yyll | 2047. Maths | 11 May 2021 19:35 | 1 | Edited by author 11.05.2021 19:41 | | Frustrating beauvoir of the Judge -- data type limit issue with C++ -- | Nouaili | 1209. 1, 10, 100, 1000... | 11 May 2021 01:55 | 1 | | | Can't figure out the WA on test #3. Please, help | Nouaili | 1209. 1, 10, 100, 1000... | 10 May 2021 17:44 | 1 | I checked the output of my code for all K ( 1 <= k <= 65535), I think it gives the correct output. https://github.com/Mourad-NOUAILI/Timus-Online-Judge/blob/main/1209/WA%233 long long type is used. Code explanation: I use a(k) = 1, 2, 2, 4, 4, 4, 8, 8, 8, 8, 16, 16, 16, 16, 16, 32, 32, 32, 32, 32, 32, 64, 64, 64, 64, 64, 64, 64,... to compute a(k) https://oeis.org/search?q=1%2C2%2C2%2C4%2C4%2C4%2C8%2C8%2C8%2C8%2C16%2C16%2C16%2C16%2C16&sort=&language=english&go=Search the pos(k) in a(k) from 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 4, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 8, 7, 6, 5, 4, 3, 2, 1,.. https://oeis.org/search?q=1+0+2+1+0+3+2+1+0+4+3+2+1+0&sort=&language=english&go=Search sequences are 0-base indexing. example: k = 16 --> a(15) = 32 = (100000)2 pos(15) in 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 4, 3, 2, 1, 0, 5, 4,... is 5, which means we gonna pick the bit at the 5th position from the left in 100000 100000 543210 so, for k = 16, the answer is 1 Thanks. | | About understanding of problem | LaVuna [KHNURE] | 1431. Diplomas | 8 May 2021 12:17 | 1 | Edited by author 21.05.2021 00:09 | | WHAT IS IN TEST #6 | shota zedashidze | 1402. Cocktails | 7 May 2021 02:43 | 7 | I have the same problem. I printed "endline" after answer. Where did you print endline ? I have the same problem - WA6... |
|
|