|
|
Common BoardWhat is in test 3????? I dont know, but if you are using BFS in your solution, you should remember, that graph can contain more than 1 connected component. Try this test: 6 2 3 0 0 0 5 6 0 0 0 one of answers: 011100 тест неверный, по условию можно в любую страну перейти, а у вас например из 1 в 4 не перейти //Don't ask me. I don't know. Just work. If anybody can tell me why for (int i = k + 7; i >= 0; i--) and why we needn't n%k - Please, tell! I don't understand. using System; namespace ConsoleApp32 { class Program { static void Main(string[] args) { string[] vvod = Console.In.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); int n = int.Parse(vvod[0]); string k1 = vvod[1]; int k = k1.Length; int q = 1; for (int i = k + 7; i >= 0; i--) { int t; t = n - i * k; if (t > 0) q *= t; } Console.WriteLine(q); } } } Edited by author 13.01.2018 23:49 because we have more than 1x! (minimum 2) and less or exactly 9 (because we have 9 numbers 2...10 and it nevermind if we have more !...! than 9). so we have k = 9-2 =7 (maximum) if we use % and the number of '!' is > 10 we have wrong answer, because we have zero: x%y=0 Edited by author 19.03.2023 19:49 Make sure your code can choose devices other than the 1st one from the list... Why does this code throw a runtime error? Everything is right!! from sys import stdin pocht_1 = ["A", "P", "O", "R"] pocht_2 = ["B", "M", "S"] pocht_3 = ["D", "G", "J", "K", "T", "W"] count = 0 mesto = 1 for i in sys.stdin.split("\n")[1:]: if i[0] in pocht_1: if mesto == 3: count += 2 elif mesto == 2: count += 1 mesto = 1 elif i[0] in pocht_2: if mesto == 1: count += 1 elif mesto == 3: count += 1 mesto = 2 else: if mesto == 1: count += 2 elif mesto == 2: count += 1 mesto = 3 print(count) 1 2 0 0 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2.24 My solution is 20 lines. Easy problem. 14 lines solution with using recursive function. I have recursive function too. Whatever, Good Job! 7 lines with recursive func in python 3. Or 14 with normal look a code. All operations except clone work O(1) in my program, but clone works in O(n). Despite that fact, my solution works in 0.218s New tests were added. Thank you. Edited by author 27.09.2020 14:29 Tests not check memory leaks, but check amount of used memory... Its weard. If you dont copy robot's stacks and just relink pointers, tests not check that you have lost memory Case Learn 1 1 Learn 1 2 .... Learn 1 n Clone 1 Rollback 1 Rollback 2 .... Rollback 1 Rollback 2 Learn 1 1 ... Learn 1 n In my solution in the end youll have n losted elements and n new elements in 1 robot that is assimptotically equal to copy all stacks Read problem statement more closely. The graph can be disconnected. Read problem statement more closely. The graph can be disconnected. Really helped me a lot. import sys num = str(sys.stdin.readline().split()[0]) a = int(num[:3]) b = int(num[3:]) - 1 c = int(num[3:]) + 1 sum0 = sum([int(num) for num in str(a)]) sum1 = sum([int(num) for num in str(b)]) sum2 = sum([int(num) for num in str(c)]) if abs(sum0 - sum1 == 0) or abs(sum0 - sum2 == 0) or abs(sum1 - sum0 == 0) or abs(sum2 - sum0 == 0): print("Yes") else: print("No") using System; public class Reverse { private static void Main() { string[] numbers = Console.ReadLine().Split(new char[] {' ', '\t', '\n', '\r'}, StringSplitOptions.RemoveEmptyEntries);
for(int i = numbers.Length-1; i >= 0; i--) { double result = Math.Sqrt(double.Parse(numbers[i])); Console.WriteLine($"{result:F4}"); } } } Edited by author 07.03.2023 20:45 What in 35 test, I always get WA Edited by author 06.03.2023 04:44 Edited by author 06.03.2023 04:50 #include<stdio.h> #include<math.h> unsigned long a[70000]; int main() { unsigned long i,k,n; long double l; scanf("%lu\n",&n); for(i=0;i<n;i++) { scanf("%lu",&a[i]); } for(i=0;i<n;i++) { l=((sqrt(-7+8*a[i])-1)/ 2); k=l; if(l==k) printf("1 "); else printf("0 "); } return 0; } a=input() a1=list(map(int,input().split())) b=input() b1=list(map(int,input().split())) c=input() c1=list(map(int,input().split())) cnt=0 for i in a1: if i in b1: if i in c1: cnt+=1 print(cnt) What is test case no #37?Or give me some test case.. Try this: ACbcBaAbCBCa, you definetely can connnect them Not correct test.The sequence has exactly n lowercase letters and exactly n uppercase letters. dont forget return in your functions you need to check, what element exist in your map Edited by author 28.02.2023 17:06 #include <cstdlib> #include <iomanip> #include <iostream> #include <cstdio> #include <math.h> #include <vector> #include <string.h> #include <algorithm> using namespace std; vector <double> numbers = {}; int main(int argc, const char * argv[]) { double n; while (std::cin >> n) { numbers.push_back(n); if (cin.peek() == '\n' ){ reverse(numbers.begin(),numbers.end()); for(int i = 0;i < numbers.size();++i){ cout<<fixed<<setprecision(4)<<sqrt(numbers[i])<<endl; } break; }; }
return 0; } I have a correct answer with input numbers in sample, and i see message "wrong answer" in 2 test. First test was passed, but i don't see where i lose... I think is bigger problem is surmise, what stoi dont work for long long integers Seems, programmers just know physics quite poorly) This is just gauss. But don't forget about multiple edges. |
|
|