|
|
вернуться в форумWhat is TEST#2 Give me some tests. This My Code: int min =Integer.MAX_VALUE; while((x = in.read())!=-1) { if(x!=10 && x!=13){ um++; if((char)x!='*') { k = Integer.parseInt((char)x+""); a[++count] = k; } if((char)x=='*'){ for (int i = 1; i <= count-m+1 ; i++) { sum = 0; for (int j = i; j <= i+m-1 ; j++) { sum = sum + a[j]; } if(sum <= min) { min = sum; ind = um - count + i; if(um<n) ind--; }} count = 0; Arrays.fill(a,0); } } } for (int i = 1; i <= count-m+1 ; i++) { sum = 0; for (int j = i; j <= i+m-1 ; j++) { sum = sum + a[j]; } if(sum <= min) { min = sum; ind = um - count + i ; } } if(ind == 0)System.out.println("0"); else System.out.println(ind); } } My Answers: /* 40 5 12368145698754*11111*21*111*00001000000 ans = 35 40 5 12368145698754*11111*21*111*0000100*0000 ans = 31 40 5 00001000*0000*12368145698754*11111*21*111 ans = 4 */ Re: What is TEST#2 I give many tests to your programm, all answer is true. But I don't now why WA. Re: What is TEST#2 These answers are wrong. In the first test Ans=34 In the second test Ans=29 In the third test Ans=1 There is sentence in the problem statement: "If there are more than one such value for L, then write the smallest one." And at last: 1. N and K are situated on the single (first) line 2. In some of your tests real number of symbols doesn't correspond the number N: somewhere it is less, somewhere it is more. Re: What is TEST#2 I got Crash#11 But when I wrote "if (k > n) k = n;" I got WA#7 And when "int[] a = new int[110000];" (not 100000) I got AC :) |
|
|