Common BoardGive me SOLUTION ,please. Hint for C: Just Store and print. It might get a Memory Limit Exceeded. Then take some special care to avoid MLE. Edited by author 11.04.2006 23:52 it must work, but WA test 1? type elem=record name:string;fuck:string;end; var a:array[1..1000]of elem; n,i:word; begin readln(n); for i:=1 to n do begin readln(a[i].name,a[i].fuck); end; writeln('Slytherin:'); for i:=1 to n do if a[i].fuck='Slytherin' then writeln(a[i].name); writeln(''); writeln('Hufflepuff:'); for i:=1 to n do if a[i].fuck='Hufflepuff' then writeln(a[i].name); writeln(''); writeln('Gryffindor:'); for i:=1 to n do if a[i].fuck='Gryffindor' then writeln(a[i].name); writeln(''); writeln('Ravenclaw:'); for i:=1 to n do if a[i].fuck='Ravenclaw' then writeln(a[i].name); end. 8th line is wrong. (readln(a[i].name,a[i].fuck);) need two line readln(a[i].name); readln(a[i].fuck); Please delete your code. Edited by author 29.12.2006 10:44 1 aaaaaa bbbbb Gryffindor Edited by author 21.10.2013 15:02 give me some tests!!! 4 Ivan Ivanov Gryffindor Mac Go Nagolo Hufflepuff Um Bridge Slytherin Tatiana Henrihovna Grotter Ravenclaw quite difficult problem to solve without knowing dfs :) Edited by author 21.10.2013 13:32 сабж, кроме того что он достаточно большой Edited by author 21.10.2013 01:16 Sometimes I get WA1 when I submit with "G++ 4.7.2 C++11", but the same code gets AC when submitted with "Visual C++ 2010". Does anyone use C++11 compiler? Does it work for you? A couple of identical submissions with different compilers getting AC and WA1: 5268491 and 5268493 I cant understand my mistake for WA2. I tried it on my PC. Its work. Edited by author 19.10.2013 14:34 can you post your code? I cant understand my mistake for WA2. I tried it on my PC. Its work. Edited by author 19.10.2013 14:34 Edited by author 19.10.2013 16:29 Edited by author 19.10.2013 16:28 var s,s1,s2: string; i,f,n,m,k,l,p,j,code: longint; ch:char; begin readln(s); readln(n); for i:=1 to n do begin readln(s2); if s2[1]='p' then begin Val(s2[13],j,code); Val(s2[15],k,code); s1:=copy(s,j,k-j+1); f := 0; for p:= 1 to length(s1) div 2 do if s1[p] <> s1[length(s1)-p+1] then begin writeln('No'); f := 1; end; if f = 0 then writeln('Yes'); end else begin Val(s2[8],m,code); ch:=s2[10]; delete(s,m,1); insert(ch, s,m); end; end; end. Maybe multiple No's? But you will take TLE. Try this test: aacdeabcdeabcdeabcde 1 palindrome? 1 20 #include <iostream> using namespace std; int main() { int n, i, j; cin >> n; long *a = new long[n]; long *b = new long[n]; long *c = new long[n]; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i <= n - 3; i++){ b[i] = a[i] + a[i + 1] + a[i + 2]; c[i] = i + 2; } for (j = 0; j <= n; j++) for (i = j+1; i <= n; i++) if (b[i] == b[j]){ c[i] = c[j]; } long max = b[0]; long imax = c[0]; for (i = 0; i <= n - 4; i++) if (b[i] < b[i + 1]){ max = b[i + 1]; imax = c[i + 1]; } cout << max << ' ' << imax << endl; } Edited by author 20.10.2013 00:12 Edited by author 20.10.2013 00:12 #include <iostream>; #include <vector>; using namespace std; int main() { vector<int> v; int n; while (std::cin >> n) v.push_back(n); int i; for(i = v.size() - 1; i>=0; i--) printf("%.4f\n", sqrt((double) (v[i]))); system("pause"); return 0; } P.S. А тесты на которых проверяются программы можно увидеть? Hey dude, did you read FAQ? Why did you decide to include system("pause") in your code? Do you think it will help testing system to check your code??? I delete it when I check, but forget to delete, when copy it here Edited by author 16.06.2013 16:22 Edited by author 16.06.2013 16:22 Edited by author 16.06.2013 16:22 Ты вроде Сергей, почему по русски не ответил? Edited by author 16.06.2013 16:23 У меня тоже самое: в консоли числа совпадают с ответом для первого теста, а в результатах проверки Wrong answer У меня сейчас немного изменилось положение, я понял, что не совсем понимаю, как должен заканчиваться поток данных. Я например его завершаю нажатием ctrl+z, понятия не имею откуда я это знаю, видно некоторые знания в университете попадают в голову в не зависимости от моего желания) Так вот, я обычно тестил и завершал этим, а сейчас ввожу первую строку ,потом вторую допустим 4444444444 4444444444444 и поток завершается сам собой, причем ответ только для одного числа, т.е. ошибку вроде нашел, но как с ней бороться не знаю. Use files to test your program locally I used files for testing and got an error in the first test. My answer is the same as in example. Also I used in my testing text from example. Вот мой код. Замени int на double в векторе и n #include <stdio.h> #include <conio.h> #include <algorithm> #include <iostream> #include <iomanip> #include <math.h> #include <vector> #include <set> #include <map> #include <queue> #include <deque> #include <string> using namespace std; int gcd (int a, int b){ return (b)? gcd(b,a % b) : a; } int lca (int a, int b){ return a / gcd(a,b) * b; } int main() { vector <long double> a; long double n = 5.0; while(cin >> n) a.push_back(n); for(int i = a.size() - 1;i >= 0; --i) cout << fixed << setprecision(4) << pow(double(a[i]), 0.5) << endl; return 0; } Первый тест - это ввод исходных данных из примера и ожидание вывода результата примера. А число 876652098643267843 уже больше значений типа int. Поэтому первый тест ломается уже на сканировании этого числа в переменную n. 876652098643267843 влазит в тип long long int I cant find my mistake please help me what is test 5. Edited by author 19.10.2013 17:12 What a bad problem it is! It is more like a reading comprehension problem in an English exam than a programming problem! Что означает Problem locked? Problem will be unlocked in 5 minutes. Sorry. Do the segments include their endpoints? what's wrong in my code: #include <iostream> int main() { int N; std::cin >> N; int result=0; if (N=0){ std::cout << 1 << std::endl; return 0; } if (N > 0) { for (int i=2; i<=N;i++) { result+=i; } std::cout << result << std::endl; return 0; }else { for (int i=-2;i >=N;i--) { result+=i; } std::cout << result << std::endl; return 0; } return 0; } Edited by author 18.10.2013 23:00 |
|