| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| JAVA - Ошибка на тесте №2 | Igor | 1068. Сумма | 2 фев 2015 00:13 | 1 |
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 |
| Why C++ help | Barbs | 1493. В одном шаге от счастья | 1 фев 2015 21:41 | 1 |
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; } |
| Test 2 WA | kzSysadmin | 2025. Стенка на стенку | 1 фев 2015 17:42 | 1 |
What's in test 2? As I understand, it's not necessary that number of people in each team is the same. |
| weak tests | Salimov Albert | 1295. Бред | 31 янв 2015 22:44 | 4 |
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. |
| what's wrong with it? | JollyRoger | 1001. Обратный корень | 31 янв 2015 19:52 | 1 |
#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; } |
| Runtime Error. Why? | Derrick Ong | 1001. Обратный корень | 31 янв 2015 06:04 | 1 |
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 |
| WA#6 | qmakar | 1022. Генеалогическое дерево | 31 янв 2015 01:39 | 1 |
WA#6 qmakar 31 янв 2015 01:39 |
| Example? | Me | 1048. Сверхдлинные суммы | 31 янв 2015 01:12 | 3 |
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 |
| This keeps getting Wrong Answer error and I couldn't figure out the problem ? | ATTJ | 1787. Поворот на МЕГУ | 30 янв 2015 20:49 | 2 |
#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 |
| WA 11 | Ilya | 1019. Перекрашивание прямой | 30 янв 2015 09:55 | 1 |
WA 11 Ilya 30 янв 2015 09:55 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. |
| WA 2 with C++ | Fritee | 1027. Снова D++ | 30 янв 2015 01:17 | 1 |
[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 |
| Some tests | Al.Cash | 1548. Сакура и статистика | 29 янв 2015 22:20 | 2 |
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 |
| 1820. Ural Steaks | ajfater | | 29 янв 2015 21:45 | 1 |
In the name of who make the worlds Hello When I running my code in vb 2010 my code is correct, but when I submit in site, site saying me "wrong answer" with 8 "test#". What's the problem? Is it in my code or on site my code: #include <iostream> #include <cmath> using namespace std; int main() { //description int n , k ; //input cin >> n >> k ; //calculating if ( ( ( 2 * n ) % k ) == 0 ) { n = ( 2 * n ) / k ; } else { n = ( 2 * n ) / k ; n ++ ; } //output cout << n ; //end return 0; } Thank you Bye A.J.Fater |
| foe those who ask which data xstructure u need to solve it | Arseniy | 1494. Монобильярд | 29 янв 2015 20:01 | 2 |
You need set. Think how to use it here No, you don't need a set. Any simple linear data structure will do. |
| hint wa22 | Evgeniy[VVV] | 1612. Трамвайный форум | 29 янв 2015 16:29 | 1 |
check this test: tram,tram Right answer is Tram driver :) Edited by author 29.01.2015 16:30 |
| WA #15 | Xysia | 1045. Забавная игра | 29 янв 2015 13:46 | 3 |
WA #15 Xysia 28 июн 2009 00:06 ok, now I have AC :) Edited by author 29.06.2009 17:03 If you have WA15, try this test: 5 1 1 3 1 2 1 4 1 1 My AC program outputs: First player wins flying to airport 2 Read carefully: "...If there are several such airports, the program should find one of them that has the minimal number..." Tnx :) it helped! but your test data shoud be: 5 1 1 3 1 2 1 4 1 5 :D |
| Everyone speaks at least one language? | Orfest (Novosibirsk SU) | 1964. Китайский язык | 28 янв 2015 00:14 | 2 |
Does everyone speak at least one dialect? |
| Test13 Wrong answer | KoshMar | 1964. Китайский язык | 27 янв 2015 23:54 | 3 |
Why? --- My fault Edited by author 29.06.2013 02:09 this problem is very very easy ,some hints from AC code ......... for(i=0;i<k;i++){ ......... s+=n-t; } n-=s; if(n<0) n=0; ...... I didnot undestand why //Сложность: 308 // ????!!! The issue is for minimization. Edited by author 28.01.2015 00:41 |
| WA #7 What is the problem? Pascal | Mosca Felice | 1964. Китайский язык | 27 янв 2015 23:29 | 2 |
var a: int64; n:int64; sum:int64; i,k:integer; begin read(n,k); a:=0; sum:=0; for i:=1 to k do begin read(a); sum:=sum+a; end; if sum-n >=0 then write(sum - n) else write('0'); end. Edited by author 03.01.2015 03:26 Edited by author 03.01.2015 03:27 Algorithm mistake, example: 2 3 2 2 2 Your answer is 4, but should be 2. Edited by author 27.01.2015 23:29 |
| 1025 WA#2 (C) | kh1024 | 1025. Демократия в опасности | 27 янв 2015 05:35 | 2 |
Issue resolved, see below! Edited by author 27.01.2015 05:49 So, be careful if manually calculating - subtle fact is that the aggregate majority of a sequence of numbers may not actually represent the majority from each individual group, for example (from another thread): 5 5 5 5 5 5 => 9 But at first, I naively calculated (5+5+5)/2 + 1, which works in other group sizes but not for duplicate numbers. So, just keep that in mind :) Edited by author 27.01.2015 05:49 |