Общий форумwhat answare on input = 6 Yep, and for 7 8 9 10 give some answers too plz:) Btw, why when n = 5 ans answer is 25. Somehow I managed to find 28 trianles. This is very foolish task. I think, it hasn't right answer. It is not really to describe all sides of this program!!! It is not foolish, and quite easy problem. In other case, why so many authous solved it??? I think there are at least 1574 authors, who don`t think so. Authors Solved 1574 subj Edited by author 30.10.2007 21:16 Try test 1 1 0 true? I also get 0. But WA15 Edited by author 03.03.2007 14:22 Edited by author 03.03.2007 14:22 Edited by author 03.03.2007 14:22 YES!!!!!!! Try this test 2 1 ))))) Thanks, AlMag! Sorry Edited by author 03.03.2007 15:44 Thanks to AlMag Why Wa 15 {$Apptype console} Const Find = 12344321; Type Longint = int64; Var a , b : array [1..10000000] of longint; N , k : longint; Function Ans(x : longint):longint; begin if b[x] = Find then begin Ans := a[x]; exit; end; b[x] := Find; if odd(x) then a[x] := Ans(x - 1) else a[x] := (Ans(x div 2) + Ans(x - 1)) mod k; Ans := a[x]; end; Begin Read(N , K); // if k = 1 then k := Trunc(1e14); b[2] := Find; a[2] := 1; if n < 2 then write(0) else Write(Ans(N)); readln; readln; end. What is 9th test??? 6 0 10 0 20 0 30 0 99 0 100 0 0 This simple test help me with test 9 My program answers for this test is 10(I'm think it's right answer), but my program gives wa#8. in this test answer is 100 My program answer 100, but I have WA9 Edited by author 28.10.2007 20:04 8 0 10 0 20 10 20 100 20 0 30 0 99 0 100 0 0 Answer 969 Yes, 969 The problem needs not many tests because of simple logic. Each pair of vertex must be connected with line therefore O(n^3) loop : (i,j,k), but with __int64 veryfication of belonging to some line. Oh sorry/it's really 100. My prog. works with simple integers. And it's much more quicker than int64... Is there any way to submit my code to some problems with email? WA :( Can anyone give me some sly tests? Tried to use STL (map, vector), but get TL11. Please, give me idea, how to use in this problem triple tree? Can't find any algorithms. Thank you! Edited by author 27.10.2007 23:49 does it mean: -3, -2, -1.. etc? or say: -1 (1 1 2 -2 -1) i am choosing the last 5? Edited by author 27.10.2007 17:16 I don't understand why my program is wrong. Please help me. Give me some hints or tests. Thanks i had WA7 too try this test 2 1 1 1 0 0 answer 0 my binary search was going funny:) from (0 to -3000:))) ) good things can't come from this.... It's nearly O(n) and it only uses 0.001 second. As follows: #include<stdio.h> #include<string.h> #include<math.h> int n,s; int f[100001]; int gcd(int a,int b) { if(b==0) return a; return gcd(b,a%b); } void work() { int i,j,k,max=0; memset(f,0,sizeof(f)); f[s]=1; for(i=s;i<=n;i++){ if(f[i]){ if(i>100) k=gcd(i,100); else k=gcd(100,i); k=i/k; for(j=k;j<=i&&i+j<=n;j+=k){//据说只要加到100%就可以了 if(f[i]+1>f[i+j]) f[i+j]=f[i]+1; } if(f[i]>max) max=f[i]; } } printf("%d\n",max); } int main() { int i; scanf("%d%d",&n,&s); work(); return 0; } It's nearly O(n) and it only uses 0.001 second. I'm sorry I didn't saw the rule... "Messages should NOT contain source code (especially correct solutions). " Fogive me // A small hint : use the GCD.. Edited by author 26.10.2007 08:58 n=111 s=110 There is no sequence that that leads form 110 to 111. Is it possible such test? I got WA on test 2 and really don't know why. Are this correct?: input 400 100 output 7 ------ 123 14 9 ------ 333 2 20 ------ 1000 67 11 ------ 5678 567 8 ------ 9800 100 22 ------
Thanks Latest salary (!) did not exceed n. It means that latest salary can be equal or less than n. Correct answers for your tests: 1) n = 111, s = 110 answer: 1 (110 - first and latest salary) 2) n = 400, s = 100 answer: 8 3) n = 123, s = 14 answer: 7 4) n = 333, s = 2 answer: 20 5) n = 1000, s = 67 answer: 7 6) n = 5678, s = 567 answer: 6 7) n = 9800, s = 100 answer: 23 Thank you very much!I had the same mistake.....How fooooool I was!!! I dont know/My programm out 3 in the 1 test/And it is wrong.But if wright cout << "3"; it is right/ ??????? Check if you are reading the entire line. Also check if you clean the buffer (cin.ignore()) before reading. i wright ..... while ( cin.get(c) && (int)c!=10 ) ....... and it is wrong?? If you checking the new line character I think '\n' is safe. in the end of file there are enter character or not? I don't know. I suggest you to use string s; getline(cin,s); to get an entire line in s. Before all this, you need cin.ignore(); to clean the buffer. i've got WA 1/ It does not help. i use cin >> n; ... cin.ignore(); while ( i<=n && getline (cin,s) ) { int t=0; find (i); ++i; } ... cout << sum ; What is "find(i)"? May be you don't need getline inside while(*). I don't know if it is allowed, but you can compare yours with my code: #include <iostream> #include <string> #include <set> using namespace std; int main() { int n; cin >> n; set<string> ss; string s; int k=0; cin.ignore(); for (int i=0;i<n;i++) { getline(cin,s); if(ss.find(s)!=ss.end()) k++; else ss.insert(s); } cout << k; return 0; } Edited by author 25.10.2007 04:00 Edited by author 25.10.2007 04:00 i am doing almost the same thing. : (999999999) (000000001) ----------- (100000000)0 (999999999) (999999999) ----------- (9)8 And final hit: (544444444) (555555555) ----------- (100000000)099999999 If your program passes these tests successfully - then you're a unique person :))) they work:) wa on test 6:) Maybe you don't cut off same parts (this task has many cases)???? Edited by author 31.10.2007 02:44 this is my algorithm printf(minfactor(k)-1) where minfactor(k) - min x, such k % x == 0, x>2 i have proof for my algorithm... where my mistake? Edited by author 28.09.2007 11:00 Number 2 is very important... Are there tests like this? 3 4 2 2 1 3 1 7 2 2 1 4 |
|