|
|
Common Board3 5 -> 4 5 3 -> 5 1 5 -> 0 5 1 -> 1 10 10 -> 18 99999 99999 -> 199996 2147483647 2147483647 -> 4294967292 I hope it helps! in tree sum of vertex <= n + n/2 + n/4 +... = n*(1 + 1) = 2n Try below test with empty line as a text: --- start of input --- world # --- end of input --- Be careful, input in HEX can be presented as: 77 6F 72 6C 64 0D 0A 23 0D 0A 0D 0A The answer is: --- start of output --- 0 --- end of output --- Be careful about an empty line before 0. I got stuck with RE#15 (dp+dfs). Non-recursive algo with same idea got AC. Hope this information helped. I don't use ";" in the end. I use Console.Write() and not Console.WriteLine(). According to the interpreter my PIBAS programm is correct. Still I've got WA#1. I'd like to have some hints from people with C# AC. Disregard that. I don't understand how I checked my program a dozen times and didn't see the obviously wrong length of last substring! Funny thing about the interpreter provided by DR. Zhihua Lai: it does not react to substring length which is higher than the length of an actual string. That's why my PIBAS programm worked well in interpreter but gave me WA1 here. Bitsets instead of binary_search helped me found = False s= str(input()) for k in range (2, 37): try: h = int(s, k) if h%(k-1)==0: print(k) found = True break except: pass
if not found: print('No solution')
AC QH 10H JC KC 4D AC AC 4D 5D AD 4C 5C JC 2H AC 5C 5D AD 5S 5H JC 2H AC 5C 5D AD 5S 5H JC 2H AD 5C 5D AD 5S 5H JC JH JD JS 8H JC 8C 8D 10H 8H 10H 10D 8D 9D 3D 3C 3H AH AS 2C 3D 4H 2D 3H 4S AH AH 8C QC JC JD 9D KD 3H 3H 8C QC KC JD 9D KD 3H 3H 10C QC KC JD 9D KD 3H 3H 5C 10C 10D 10S 9D 6D 3H 3H AC 10C 10D 10S 9D 6D 3H 3H AC 10C 9C 10S 9D 6D 3H 3H AC 10C 9C 10S 10D 6D 3H 4S AH AS AD AC 10C 10S 3H 4S AH AS AD AC 10C JC 3H 4S AH AS AD AC 10C JC 3H 4S AH QS KD AD KC JD 3H 4S AH QS KD AD KC JD 3H 4S AH AS KD AD AC QD 3H 4S AH AS 3D KS KC 2D 3H 4S AH AS 3D KS KC 2D 2H 2S AH AS 3D KS KC KD 2H 3H AH AS AD KS KC KD 2H 3H 3S 4C 5C 2S 4S 5S AH AD 3S 4C 5C AS AH 2C AH AD 3C 4C 5C AS AH 2C AH AD 3C 4C 5C 2S 7S 10S AH AH 4S 5D 8H 5S 7S 8D 3C 2D 4S 4D 4H 5S 5D 2H 2C 2D 4S 4D 4H 5S 5D 3H 3C 3D 4S 4D 4H 5S 5D 6H 6C 6D 4S 4D 4H 5S 5D 5H 5H 5H AH AS JS AC AD 10S KS KD AH AS KH AC AD 10S KS KD 3C 4C 5C 4S 5S 6S AH AH 3C 4C 5C 3S 4H 5D AH AH 2S 4S 5S 7D 4D 5D AH AH 3D 4D 5D 2S 3S 4S AH AH 4C 4D JS 4S 4H 3H 7S 7S 4C AC 2C 4S KD 6H 5C KH JS 8H JC 8C 8D 10H 8H 10H 10D 8D 9D 3D 3C 3H AH AS 2C 3D 4H 2D 3H 4S AH AH Sasha Dima Artyom Sasha Dima Sasha Dima Artyom Dima Sasha Sasha Sasha Sasha Sasha Sasha Sasha Sasha Sasha Sasha Sasha Sasha Dima Dima Dima Sasha Sasha Dima Sasha Sasha Dima Sasha Dima Dima Dima Dima Artyom Dima Sasha Dima Sasha Sasha Dima Sasha Dima Artyom The output needs to be sorted in ascending order(!) so for test number 5: 45 the correct answer is 59 (5*9) and 95 (9*5) will be rejected. Hope this helps someone. Mine does return 59 yet its said to be WA simple anwser: WA Edited by author 13.11.2022 12:39 1 12 1 1 10 8 1 1 8 10 1 1 9 3 1 1 7 4 1 1 2 4 1 1 5 4 1 1 2 5 1 1 9 9 1 1 3 5 1 1 9 2 1 1 9 5 1 1 5 9 1 1 6 4 Ans: 1 4 Also, check that you print "Impossilbe", when it's impossible to achieve the finish vertex I have correctly performed all tests from the forum, but still WA 3. Please tell me what the problem is or write new tests for me. 8 30 => 35 and not 36 12 26 => 35 and not 36 14 28 => 39 and not 40 15 30 => 42 and not 43 16 32 => 45 and not 46 20 22 => 39 and not 40 20 43 => 60 and not 61 28 27 => 52 (you get the idea) Thanks for the tests, pal. solution on the surface, take a look at the arithmetic mean P #include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while(t--){ string s; cin >> s; int a = int(s[1] - 48); if(s[0]=='a' ||s[0]=='h'){ if(a==1 ||a==8) cout << 2 << endl; else if(a==2||a==7) cout << 3 << endl; else if(a>2) cout << 4 << endl; } else if(s[0]=='b'||s[0]=='g'){ if (a == 1 || a==8) cout << 3 << endl; else if (a == 2|| a==7) cout << 4 << endl; else if (a > 2) cout << 6 << endl; } else{ if (a == 1|| a==8) cout << 4 << endl; else if (a == 2|| a==7) cout << 6<< endl; else if (a > 2) cout << 8<< endl; } } } Из точки (2,2) мы можем попасть в (1,1),а потом в (0,0), сразу в (0,0), в (1,0),а потом в (0,0). В первом случае t=0.63246+0.23277=0.86522, во втором t=0.86522, в третьем t=0.70711+0.15811=0.86522. Я использую формулу для t=(-v+sqrt(v*v+2*g*len*sina))/(g*sina)),если наклонный отрезок и t=len/v иначе. Попробуй вариант 2,2 -> 2,1 -> 0,0 (опускаемся на 1 вниз(по вертикали), потом проводим до конца(по диагонали)) I tested for a long time and tried to understand why the thymus mockingly shows me such a mocking number, it's all because of the portals, it's just impossible there, I got so confused in them that I didn't understand how my code worked, in general, how to avoid such a problem. add all sorts of checks near the portals, which is right wherever there are portals, just destroy these portals completely, absolutely dont add negative numbers to answer i think its something like this 2 ab\df\fd df\df ab df fd df df fd Сама задача конечно же довольно простая. Решив ее несколькими способами я каждый раз упирался в превышение объема допустимой памяти на 11 тесте. Соответственно львиная доля времени ушла на осознание того, что же именно потребляет память и на устранение этого узкого места. Как можно было догадаться, память жрали Строки. Я убрал использование string отовсюду кроме считывания данных из консоли. Хранение данных реализовано через два массива int. Для разбора ввода и для вывода ответов в консоль использовались массивы int и char. Вообще, это одна из тех задач, которые отлично иллюстрируют проблему, описанную в FAQ "Как писать решения на C#": "В некоторых задачах потребуется собственная быстрая реализация разбора входных данных и форматирования выходных". Только здесь проблема не в скорости, а в памяти. somebody faced this problem? somebody has a test data? Try this 4 8 1 8 8 should give 1 4 8 8 1 8 also should give 1 |
|
|