Common Boardтест 1: n=9 k=2 тест 2: n=1 k=1 тест 3: n=10 k=1 тест 4: n=8 k=1 тест 5: n=10 k=2 тест 6: n=7 k=2 тест 7: n=1 k=2 тест 8: n=2 тест 9: n=10 k=5 тест 10: n=9 k=5 n=3,4,5,6 не встречается... тест 8 - к по условию не может быть меньше 1. В единственной строке сначала дано целое число n, 1 ≤ n ≤ 10, затем ровно один пробел, затем k восклицательных знаков, 1 ≤ k ≤ 20. про значение К в этом тесте не известно а какой ответ на 9 тест? 1) 50 Очень интересно а как вы эти тесты извлекли? Edited by author 10.02.2010 23:53 Какой ответ на тест 5? 945? Тест 8 - просто супер. Явная неучтенка. И сколько еще таких тестов? Просто офигенная постановка задачи. Edited by author 16.04.2011 19:50 Скажите,пожалуйста, какой должен быть ответ в тесте номер 8? Я уже пробовала,чтобы программа не пропускала такие варианты с помощью repeat, пробовала ставить в таком случае ответ 1, ответ 0, ответ - само число. Ничего не получается! Edited by author 29.07.2014 13:12 Тест 10: 9 !!!!! = 9(9-5)(9 mod 5) = 9*4*4 = 144 Почему вылазит неправильный ответ?! N mod K — это последний больший нуля элемент ряда N - XK. В данном случае этот элемент первый и он же последний, не нужно умножать на него два раза. Иными словами, мы вычитаем K от исходного числа, и умножаем на получившееся, и повторяем так до тех пор, пока получившееся число не станет нулём или меньше. Еще вопрос: 2 !!! = ? 2 или 4? и какие вводные 11-го теста? Меня очень интересует как в примере 9 !! получилось равным 945 если разбирать описание задачи то получим: n = 9 k = 2 n mod k = 1(есть остатое от деления) тогда получаем 9!! = 9*(9-2)*1 = n(n-k)(n mod k) = 9*7*1 = 63 Ну откуда 945 невкурю???? This problem is easily solving without any precalcing or info about tests. Not more than 15-20 lines of code. I did not ask about the problem of solving the problem. I asked about the correctness of my reasoning, I can not right in the calculation of 9 !! 9 !! i 1) n:=9*(9-2) 2)n:=63*(9-4) 3)n:=315*(9-6) 4)n:=945*(9-8) This is correctness of your reasoning. In my program test 5 is correct, but system writed, that wrong. Answer - 7680 In my program test 5 is correct, but system writed, that wrong. Answer - 7680 All manual tests ok. Test 5 is also in error. I do not understand this... import java.util.*; public class Factor { public static void main(String[] args){ Scanner put=new Scanner(System.in); int n,k,fac; String ffc; n=put.nextInt(); ffc=put.next(); k=ffc.length(); fac=n; for(int i=1;i<(n/k);i++){ fac=fac*(n-(i*k)); } if(n%k!=0)fac=fac*(n%k); else fac=fac*k; System.out.print(fac); } } Edited by author 29.10.2012 17:37используя гамма функцию можно в одну строчку :) Застрял в тесте 8: #include<stdio.h> #include<string.h> int main(){ int n, i, l; char k[20]; scanf("%d%s", &n, k); l = strlen(k); int result = n; i = n - l; do{ result = result * i; i = i - l; } while (i > n % l); if (n == 1) result = 1; printf("%d", result); return 0; } Edited by author 02.12.2017 02:41 Edited by author 02.12.2017 02:41 Edited by author 25.07.2014 12:47 9 !! = 9*(9-2)*(9-2*2)*(9-2*2*2)....*1=9*7*5*3*1=945 Answers for numbers from topic: 1. 945 2. 1 3. 3628800 4. 40320 5. 3840 6. 105 7. 1 8. 2 (if in this case k = 1) 9. 50 10. 36 Моё нестандартное решение :) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class proga { public static void main(String[] args) throws IOException { BufferedReader sc = new BufferedReader(new InputStreamReader(System.in)); String[] temp = sc.readLine().split(" "); int ch = Integer.parseInt(temp[0]); int len = temp[1].length(); int ost = ch%len; int result = ch; if(ost==0){ost+=len;} while(ch!=ost) { ch-=len; result*=ch; } System.out.println(result); } } а какой ответ на тест 5 ? what's the right answer for test 5 ? who knows ? can you give a hand pls тест 1: n=9 k=2 тест 2: n=1 k=1 тест 3: n=10 k=1 тест 4: n=8 k=1 тест 5: n=10 k=2 тест 6: n=7 k=2 тест 7: n=1 k=2 тест 8: n=2 тест 9: n=10 k=5 тест 10: n=9 k=5 n=3,4,5,6 не встречается... why wrong on test 5?? #include<iostream> //#include<string> using namespace std; int main() { int n; string s; cin>>n; cin>>s; int sum=n; int len = s.size(); //cout<<len<<endl; int i =1; while((n-i*len)>1) { sum*=(n-i*len); i++; } if(n%len!=0) cout<<(sum*(n%len))<<endl; else cout<<sum*len<<endl; return 0; } 8th test is 2 !! and the answer is 2 incorrectly selected transfer static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] values = new int[n]; for (int i = 0; i < n + 1; i++) { string[] str = Console.ReadLine().Split(); int a = int.Parse(str[0]) - 1; int b = int.Parse(str[1]) - 1; int c = int.Parse(str[2]); for (int j = a; j <= b; j++) { values[j] += c; } } Console.Write(string.Join(" ", values)); } It's simple algorithm. How to speed it up? Which algorithm should I use? Edited by author 21.01.2026 21:22 Hi, I writed this post because I wanted to share with you some of the test cases* that helped me a lot at the time. I hope it helps you :) --> Test 1: 1 A B C --> Answer: A undefined B undefined C undefined ------------------------------ --> Test 2: 5 Isenbaev A B A B C D Q P C H N G N P --> Answer: A 1 B 1 C 2 D 5 G 4 H 3 Isenbaev 0 N 3 P 4 Q 5 ------------------------------ --> Test 3: 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 --> 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 ------------------------------ --> Test 4: 3 Isenbaev A B A B C A Q W --> Answer: A 1 B 1 C 2 Isenbaev 0 Q 2 W 2 ------------------------------ *(All test cases were made by other users, so you'll probably found them in other Posts/Topics/Discussions). Acknowledgments to: -> "Vit Demidenko" & "Nathalie" -> "Pavel Nikolov" -> "mccolt89" -> "Megakrit" -How I solved it: I solved this problem in Java, for that, I used: ->1 java.util.Scanner ->1 java.util.HashMap ->1 java.util.TreeMap ->3 java.util.HashSet ->1 java.util.LinkedList ->? java.util.StringTokenizer (or you can just simply use the Scanner method "next()"). (The structures can be declared inside loops or other structures). Hope all this helped you :)
Edited by author 08.04.2020 00:48 Edited by author 08.04.2020 00:49 Thanks, I forgot that Isenbaev might not be on the team. See title I can currently solve problems under a rating of 50(I am a newbie) comfortably but I don't quite get how the difficulty scales really with some problems having a rating of 15000 which seems confusing. I just would like someone who has some knowledge to explain how difficulty scales numerically relative to some standard problems take codeforces or any major competitive programming competition as a reference Edited by author 08.01.2026 08:49 The incorrect test 12 was fixed (coordinates were exceeding 10000). New tests were added to the problem. The tests target a wide range of problems in geometry algorithms, accuracy issues, and performance. All solutions have been rejudged. 229 authors (40%) lost, and 2 other authors gained the Solved status for the problem. Thanks for the New Year present (had to resolve the problem just before the 2026) :))) I'm expected brute force solution will accepted on C++, because N * 10^D integer divisions might work in 1 sec, but this solution work even on Python3. Why is work? Is there a math prove that answer will be very small or in this problem weak tests? Edited by author 14.02.2023 17:29 N * 10^D is 10^7 operations which easily runs in time A bug was fixed in the checker program that incorrectly skipped most of the checks for some tests. The most affected tests are: 1, 3-8, 11, 17. All solutions have been rejudged. The verdict changed for 40% of solutions (typical change patterns: WA5 -> WA4, WA9 -> WA7, AC -> WA11). 10 authors lost the Solved status for the problem. #include<stdio.h> #include<math.h> int main(){ unsigned long long int a,b,c,d; double Sqrt,Sqrt1,Sqrt2,Sqrt3; scanf("%llu %llu %llu %llu",&a,&b,&c,&d); Sqrt=sqrt(a); Sqrt1=sqrt(b); Sqrt2=sqrt(c); Sqrt3=sqrt(d); printf(" %0.4lf %0.4lf %0.4lf %0.4lf",Sqrt,Sqrt1,Sqrt2,Sqrt3); } Edited by author 23.06.2022 13:46 Edited by author 23.06.2022 13:46 there is nowhere mentioned only 4 inputs are there so while(cin>>x) would be the conditional i hope it helps A bug fixed in the checker program that allowed passing arbitrary expressions as a first argument to the substring function. According to the problem statements only variables are allowed to be passed there. Accepted solutions have been rejudged. 26 authors lost the Solved status for the problem. a , b , c = list(map(int , input().split())) A , B , C = list(map(int , input().split())) if a+c >= A: if a >= A: c =c a-=A else: c=A-a a-=A-c if b+c >= B: if b >= B: c =c b-=B else: c=B-b a-=A-c if a + b + c >= C: print('It is a kind of magic') else: print('There are no miracles in life') else: print('There are no miracles in life') else: print('There are no miracles in life') Thanks i rewirte in java 1.8 that helps me a lot, thank you so much The missing condition added to the English version of the statement: The cell in which the minus remains should not change. The Russian version of the statement was correct. import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { String a = "Emperor Penguin"; String b = "Macaroni Penguin"; String c = "Little Penguin"; int countA = 0; int countB = 0; int countC = 0; Scanner sc = new Scanner(System.in); int n = sc.nextInt(); List<String> list = new ArrayList<>(n); sc.nextLine(); for (int i = 0; i < n; i++){ list.add(sc.nextLine()); } for (String item: list){ if (item.equals(a)){ countA++; } else if (item.equals(b)) { countB++; } else if (item.equals(c)) { countC++; } } int max = Math.max(Math.max(countA,countB),countC); if (max == countA){ System.out.println(a); } else if (max == countB) { System.out.println(b); } else if (max == countC) { System.out.println(c); } } } Edited by author 18.11.2017 03:29 Thanks to AI. After 15 years since the first submission, I finally know how to solve this problem. If you got WA #28 - check int64 overflow The limitation on N was changed to reflect the actual test data. Instead of the old N < 10^600 the limitation was set to 0 < N < 10^300. Note that this is not the limitation on the input, but rather on the output. The number given to the input has about twice as many digits, previously up to ~1200 digits, now up to ~600 digits, but the actual test data was always only up to ~600 digits. Edge case N=0 was also missing in the test data, and is now explicitly disallowed by the limitation. New thorough tests were added within the new limitations. The time limit was reduced from 2.0 sec to 1.0 sec. All solutions have been rejudged. 192 authors lost, and 12 other authors gained the Solved status for the problem. Bugs fixed in the checker program. 1. The total length of dangerous segments was not always correctly verified against the canonical answer. Most prominently, the following output was previously accepted for the sample input (test 1), which has the total dangerous length 1.0 with the optimal one being 0.8: 2 1.0 1.5 0.0 1.5 2. Precision issues were fixed that were causing solutions with certain output rounding strategies being rejected (most commonly, WA8). The limitation on the number of pieces of furniture N was updated in the problem statements from N >= 0 to N >= 1 to reflect the actual test data. Additionally, the time limit was reduced from 2.0 sec to 1.0 sec. All solutions have been rejudged. 21 authors lost, and 2 other authors gained the Solved status for the problem. |
|