Common Boardwho knows what the meaning of set of numbers is??? is it true that the user must specify how many numbers must be taken? Edited by author 03.02.2015 23:09 Здравствуйте, У меня возникают постоянные ошибки при сдаче программ на Py2.7, например задача: 1293 N = input() B = input() A = input() print 2*N*A*B Выдает RE. Тот же код на Pascal сдается: var A, N, B: integer; begin read(N, A, B); write(2*N*B*A); end. И это только единичный случай, так со всеми. Я даже не могу задачку a + b решить =\ in.nextToken(); int n = (int) in.nval; byte ch1[] = new byte[n]; byte ch2[] = new byte[n]; while (n > 0) { in.nextToken(); ch1[n - 1] = (byte) in.nval; in.nextToken(); ch2[n - 1] = (byte) in.nval; n--; } int ost = 0; String answer = ""; for (int i = 0; i < ch1.length; i++) { int a = ost + ch1[i] + ch2[i]; if (a > 9) { answer = (a % 10) + answer; ost = a / 10; } else { answer = a + answer; ost = 0; } } out.print(answer); Could someone help with time optimization? Edited by author 02.02.2015 20:11 A lot of the submissions are returning Fail(checker). There seems to be some error with the judge, most of the solutions are returning a Fail(checker) status from the judge. My program work correct with all of my test. But i have WA on third test. Can anyone give me some tests? Can you help me? I have WA on third test too. Have you got a test? me too!!! My program work correct with all of my test. But i have WA on third test. Can anyone give me some tests? me too!!! My program work correct with all of my test. But i have WA on third test. Can anyone give me some tests? Try this... --------------- yfnfnfyczs fskdkskylp nymhlaeshsw iwuicujnnxboufnfm mawwnrpdx mawkvyyptrfz nataehllelnne bimdhhycaoinese yfnfnfyfjnad xbduyr ohpb --------------- and answers are: --------------- thisistext ansthisone ilovepeople doyouspeakenglish howareyou howoldareyou inthedeathcar whereareyoufrom thisistheend secret jtim --------------- Good luck ;) There are very good tests. First I had got WA 3, but when I have used these tests, I have understood my mistake (with symbol 'a') and now I have got AC. Thank you, JTim Edited by author 12.11.2008 00:43 I got correct answers for all the test cases listed by Jtim. But I got WA 7 and for anyone wondering why this is so, It's the size of the char array I had. It was 100 and the testcase should have been using 100 chars as well, Therefore Once I increased it by 1 , I got AC. :) Hope this helps others ;) Thank you! VNXtreMe Edited by author 02.02.2015 01:24 Edited by author 02.02.2015 01:24 Edited by author 02.02.2015 01:24 Can yo answer me? Edited by author 27.09.2007 21:43 Edited by author 27.09.2007 21:43 import java.io.*; import java.util.*; public class qw { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int res = 0; if(n > 0) { for(int i = 2; i <= n; i++) { res += i; } } else if(n < 0) { for(int i = -2; i >= n; i--) { res += i; } } else res = 0;
if(-10000 <= n & n <= 10000)out.println(res); out.flush(); } } Edited by author 02.02.2015 00:14 include <iostream> using namespace std; int main() { int N=0,a=0,b=0; cin>>N; a=(N/100000)+(N/10000-N/100000*10)+(N/1000-N/10000*10); b=(N/100-N/1000*10)+(N/10-N/100*10)+(N-N/10*10); if(a-1==b){ cout << "YES\n"; } else { cout << "NO\n"; } return 0; } What's in test 2? As I understand, it's not necessary that number of people in each team is the same. my prog got AC but on 65,85,105... it answers 2,but I think the answer is 1. yes,my second prog answers 1 and got AC too. a 20-number period incorrect! Edited by author 20.05.2013 20:57 Thank you. New tests were added. 235 authors lost AC after rejudge. Edited by author 27.05.2014 13:18 Edited by author 27.05.2014 13:18 Incorrect; the answer to those is 2. #include<iostream> #include<stack> #include<math.h> #include<iomanip> float next_value = 0; std::stack<float> my_stack; int main() { int a = 0; while (std::cin >> next_value) { if (a == 65536) break; if (0 <= next_value && next_value <= pow(10.0, 18)) { my_stack.push(next_value); } else continue; a++; } while (!my_stack.empty()) { std::cout << std::fixed << std::setprecision(4) << sqrt(my_stack.top()) << std::endl; my_stack.pop(); } return 0; } import java.util.*; import java.io.*; public class root { public static void main(String[] args) { Scanner in = new Scanner(System.in);
ArrayList<Long> list = new ArrayList<Long>();
while (in.hasNextLine()) { list.add(in.nextLong()); }
Collections.reverse(list);
for (long x : list) { System.out.printf("%.4f", Math.sqrt(x)); System.out.println(); } } } Works on my computer with the given input. Edited by author 31.01.2015 06:20 For example if I take N =4. then i write: 10 12 9 3 15 10 11 13 What will I get? i think that no such input like yours. ( my ac solution does not handle it properly. ) you should write it in this way (only one digit for one number per line): 1 1 0 2 9 3 1 1 5 0 1 1 1 3 and therefore N = 7 #include <stdio.h> int main(void) {
int car_num, min, i, arr[100], sum = 0;
scanf("%d %d", &car_num, &min);
for(i = 0; i < min; i++) { scanf("%d", &arr[i]); if(sum + arr[i] - car_num < 0) sum += 0; else sum = sum + arr[i] - car_num; }
printf("%d", sum);
return 0;
} You're not printing a newline after printing the answer ... though I think the real issue is different: I don't believe you're handling the following cases correctly. Try this test case 5 3 6 1 2 and this one 5 3 6 1 7 Good luck! -- DC Edited by author 30.01.2015 21:10 I've checked all the tests on the forum, but all of them actually wokred. What's wrong with the code? type Otrezok=record beginning,ending:real; colour:string; end; type Point=record mean,predel:real; end; var a:array[0..50000] of Otrezok; b:array[0..50002] of Point; i,N,j,s:integer; k,j1,j2,max,f1,f2:real; t,f3:string; function colour(x:real;H:integer):string; var j:integer; begin for j:=0 to H do begin if (x>=a[j].beginning) and (x<=a[j].ending) and (a[j].colour=' w') then colour:='w'; if (x>=a[j].beginning) and (x<=a[j].ending) and (a[j].colour=' b') then colour:='b'; end; end; begin a[0].beginning:=0; a[0].ending:=1000000000; a[0].colour:=' w'; readln(N); for i:=1 to N do begin readln(f1,f2,f3); if f1<f2 then begin a[i].beginning:=f1; a[i].ending:=f2; a[i].colour:=f3; end; end; for j:=1 to N do begin b[j].predel:=0; b[j+N].predel:=0; b[j].mean:=a[j].beginning; b[j+N].mean:=a[j].ending; end; b[0].predel:=0; b[0].mean:=0; for i:=(2*N-1) downto 1 do for j:=1 to i do begin if b[j].mean>b[j+1].mean then begin k:=b[j+1].mean; b[j+1].mean:=b[j].mean; b[j].mean:=k; end; if (b[j].mean=b[j+1].mean) then b[j+1].mean:=0 end;
for i:=1 to 2*N do begin if (b[i].mean<>0) and (colour(b[i].mean,N)<>colour(b[i].mean+0.1,N)) or (colour(b[i].mean,N)<>colour(b[i].mean-0.1,N)) then b[i].predel:=1; if b[i].mean=0 then b[i].predel:=0; end; t:=colour(0,N); s:=0; for i:=0 to 2*N do begin if (b[i].predel=1) then begin s:=s+1; k:=b[s].mean; b[s].mean:=b[i].mean; b[i].mean:=k; end; end; for i:=s downto 0 do b[i+1].mean:=b[i].mean; b[s+2].mean:=1000000000; max:=0; b[0].mean:=0; for i:=1 to s+2 do begin if t='w' then begin if (i mod 2)=0 then begin if (b[i].mean-b[i-1].mean)>max then begin max:=b[i].mean-b[i-1].mean; j1:=b[i-1].mean; j2:=b[i].mean; end; end; end; if t='b' then begin if (i mod 2)=1 then begin if b[i].mean-b[i-1].mean>max then begin max:=b[i].mean-b[i-1].mean; j1:=b[i-1].mean; j2:=b[i].mean; end; end; end; end; write(Round(j1),' ',Round(j2)); end. [deleted] P.S. Don't EVER forget to initialize your variables. Edited by author 30.01.2015 01:18 Edited by author 30.01.2015 01:19 This tests helped me with WA3, WA5 and WA10, but now I'm stuck at test 20. Any hints? 4 9 010000010 111010111 101111101 000101000 answer: 9 4 5 11000 01100 00110 00011 answer: 4 5 5 11100 11110 11111 01111 00111 answer: 3 4 9 100111100 100100100 100100100 111100111 answer: 6 This helped with test 20, now WA31 to overcome! 4 5 00100 01110 01010 11011 answer: 5 |
|