Common Boardprogram ural_1012; var a1,a0,p:longint; n,k,i:integer; begin readln(n,k); a1:=k-1; for i:=2 to n do begin p:=a1; a1:=(a1+a0)*(k-1); a0:=p; end; writeln(a1+a0); end. Because you are very ugly! ~~~~ Edited by author 21.07.2007 16:48 Look at this test: 2 0 0 My accepted program outputs "0-1" when the right answer is "00". From problem statement: "From every country we can reach to any other one". Your test is incorrect. Sorry!! I was wrong. I'll read problem statements more carefully . :-) i implement sweep line algorithm, using STL set Hmmm... I also have WA-1 but my program works correct on the samples Please try my program for different input data, I don't know where I am wrong. Maybe I missunderstood problem, everyone use array, I don't think it's necessary ?! #include <iostream.h> #include <math.h> int main() { int niz[10]; int brojac = 1; int rezultat; int p = 1; int koren; for (int i = 0; i < 10; i++) cin >> niz[i]; for (int j = 0; j < 10; j++) p = p * niz[j]; if (p == 1) { cout <<1; return 0; } koren = floor(sqrt((double)p)); for (int k = 2; k <=koren; k++) { if (p % k == 0) { if (p/k == k) brojac++; else brojac = brojac + 2; } } brojac++; rezultat = brojac % 10; cout << rezultat; return 0; } What your answer for test: 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 For this test p=10^40. Please, post some tests... Hello! I've WA #2. Could anybody help me with this test??? There are N rows And M columns. My solution with M rows and N columns has got AC #include<stdio.h> #include<math.h> double a[90]; int main(void) { double ch; long int j=0; while(scanf("%lf",&ch)!=EOF && j<=90) a[j++]=sqrt(ch); for(j-=1;j>=0;--j) printf("%.4lf\n",a[j]); return 0; } Edited by author 16.07.2007 20:18 Edited by author 16.07.2007 20:18 Edited by author 16.07.2007 20:18 1. You haven't allocate memory for array a like this: float a[N]; 2. You don't need to do this: if(ch == ' ') continue; scanf() will automaticaly read only numbers. Good luck Understood. However now WA 25. And do not know why... Edited by author 13.09.2007 03:59 Who can give me test 3? My program passed test 3 after I found out that it didn't read words with spaces in them (i.e., it should read the entire line) You should build a trie, which to store the word. 1.Build the trie in reverse order 2.Make suffix links in BFS order. 3.Process the text But my algo must read the text in reverse order,so it has to use more 2000K :( Otherwise, 1500K is enough. How many vertex did you use in your tree? maxn? I have got ML 7! Me,too! -_-b Now I've solved it. We can only record the char on the node, not the pointer. [code deleted] Edited by author 01.04.2008 21:52 Please give me 4-th test.All right in my PC.I surprised. Thank you very much!!! Edited by author 13.07.2007 16:25 For input 3 3 5 1 1 2 1 3 1 1 2 1 3 the correct answer is 5 > For input > 3 3 5 > 1 1 > 2 1 > 3 1 > 1 2 > 1 3 > the correct answer is 5 > why? Why it isn't 4? 1-2,2-1,1-3,3-1 Please help me!so surprised! My code : ..... #include <iostream> #include <math.h> #include <vector> using namespace std; int main() { vector<double> v1; cout.precision(5); while (cin >> temp){ v1.push_back(sqrt(double(temp))); } for (int i = 1; i <= v1.size(); i++) cout << v1[v1.size()-i]; return 0; } Why I have wrong answer? Edited by author 13.07.2007 03:37 Edited by author 13.07.2007 03:38 Rather simple tests… For this test my AC program gives “NO”: 4 2 13 1 2 15 3 4 10 But the correct answer is YES. So as I understood, in all your tests, if graph is unconnected and there is no cycle in it, then the max length of path always contain the last (m) vertex… So all programs which use this algorithm passed all your tests: First, check knots, multigraph; Second, for (I, 1, n) - check is the i vertex is in the circle; Third, find the max length of path of that tree, which contain the last vertex; and compare it with s. INSTEAD: Third, find the max length of paths ALL TREES, and all of them compare with s. Sorry for my English. Hi to all! I have some problems with solving this task on C (but AC on Pascal).. I got WA#1 and Crash(Access violation)#1, but I can't find any bug in my program and it runs without errors on my computer.. Is it different in compilers (I use BC++5.02)? Thanks. sorry for my bad english I found my error: my prog used files! Pliz someone post here accepted code in Java for 1535 task ("Hobbit there and back") I have practice in university, my specialty not a programmer, but as u see I have this task... I have no skill... So If U will to help, pliz write to my ICQ (336-666-990) or post code here I'm sorry. I have WA1, but I don't know, what is it. All test, which I enter work corrctly, could you send me some test? 0.062 sek. 264 KB const n=15001; var a:array [1..n] of longint; t,l,m:integer; procedure Generate_array; var i:integer; root:integer; k:integer; newp:longint; prime:boolean; begin a[1]:=2; newp:=3; i:=2; while i<=n do begin root:=trunc(sqrt(newp)); k:=1; prime:=true; while (a[k]<=root) do begin if newp mod a[k] = 0 then begin prime:=false; break; end; inc(k); end; if prime then begin a[i]:=newp; inc(i); end; inc(newp); end; end; begin {$IFNDEF ONLINE_JUDGE} assign(input, 'input.txt'); reset(input); assign(output, 'output.txt'); rewrite(output); {$ENDIF} generate_array; readln(l); for t:=1 to l do begin readln(m); writeln(a[m]); end; {$IFNDEF ONLINE_JUDGE} close(input); close(output); {$ENDIF} end. Who has better results? |
|