| Show all threads Hide all threads Show all messages Hide all messages |
| WA on test nr.4 | Climova Olga | 1120. Sum of Sequential Numbers | 24 Feb 2015 13:12 | 1 |
Sorry for russian comments, I don't speak English well. Why WA? (system("pause"); is only for checking, of course) #include <iostream> using namespace std; int main() { unsigned long N, P, A; cin >> N; for (A = 1; A <= N; A++) // чтобы P было максимальным, начинаем с меньшего А { // прокручиваем P с N/A вниз, т.к. вроде бы это минимальное число с которого следует начинать for (P = N / A; P*A + P*(P - 1) / 2 > N; P--); if (P*A + P*(P - 1) / 2 == N) // если нашли - останавливаемся break; } cout << A << ' ' << P; system("pause"); return 0; } Edited by author 24.02.2015 13:16 |
| I got WA # 4.Give me some test please | xiao | 1105. Observers Coloring | 24 Feb 2015 05:00 | 3 |
OK, if someone came here for spoiler, T0 != 0 in test 4 |
| How fix Runtime error (access violation) at test 9 [ C code] | wolfbrother | 1001. Reverse Root | 23 Feb 2015 02:56 | 4 |
I don't know what problem..... Can help me ...? -------------------------------------------------------------------------- Code: #include <stdio.h> #include <math.h> main(){ unsigned long long int inn[99999],count=0; while(scanf("%llud",&inn[count])!=EOF){ count++; } printf("count:%d\n",count); for(;count>0;){ count--; printf("%0.4f\n",sqrt(inn[count])); } return 0; } ------------------------------------------------------------------------- Thanks for help. Edited by author 17.05.2014 23:37 Here is the solution in Java: import java.io.*; import java.util.*; import java.text.DecimalFormat; public class Task { public static void main(String[] args) { DecimalFormat df=new DecimalFormat("0.0000"); int i,max; double[] massiv=new double[130197];//130196 - runtime error at test #9 Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); max=1; while(in.hasNextDouble()){ massiv[max]=Math.sqrt(in.nextDouble()); max++; } max--; for (i=max;i>=1;i--) System.out.println(df.format(massiv[i])); out.flush(); } } But I don't understand the next thing: if I change the size of array from 130197 to 130196 I'll be given "runtime error" at test #9. Why it should be 130197? How does 256 Kbytes input stream correlate with 130196 double type elements ? Edited by author 20.06.2014 21:46 Edited by author 20.06.2014 21:48 Edited by author 21.10.2014 23:22 Decrease the size of you inn Array. set it to 99 then try. |
| Why the answer is Number_of_Compartments-1 | Pegasus | 1213. Cockroaches! | 21 Feb 2015 22:05 | 2 |
if the amount of baffles that should be opened is equal to N - 2, it will be not enough, because graph will be not connected, and that's why not all cockcroaches will reach the floodgate. But you can build the spanning tree of this graph. It has exactly N - 1 edges, and graph will be connected and now all cockroaches will reach the floodgate. |
| WA4 | Alexey Stulov | 2002. Test Task | 21 Feb 2015 19:38 | 1 |
WA4 Alexey Stulov 21 Feb 2015 19:38 please can anyone tell me what is the test of 4????? #include <iostream> #include <conio.h> using namespace std; struct abonent { char login[30]; char password[30]; short status; }; int main() { short n, k = 0, j, compare, index; char *part_str; char str[80]; cin >> n; abonent *peop = new abonent[n]; gets(str); for (int i = 0; i < n; i++) { gets(str); part_str = strtok(str, " "); if (!(strcmp(part_str, "register"))) { part_str = strtok(NULL, " "); strcpy(peop[k].login, part_str); compare = 1; for (j = 0; j < k; j++) { if (!(strcmp(peop[k].login, peop[j].login))) { compare = 0; break; } } if (compare) { part_str = strtok(NULL, " "); strcpy(peop[k].password, part_str); peop[k].status = 0; k++; cout << "success: new user added\n"; } else { cout << "fail: user already exists\n"; } }
if (!(strcmp(part_str, "login"))) { part_str = strtok(NULL, " "); compare = 1; for (j = 0; j < k; j++) { if (!(strcmp(part_str, peop[j].login))) { compare = 0; index = j; break; } } if (!compare) { part_str = strtok(NULL, " "); if (!(strcmp(part_str, peop[index].password))) { if (peop[index].status) { cout << "fail: already logged in\n"; } else { peop[index].status = 1; cout << "success: user logged in\n"; } } else { cout << "fail: incorrect password\n"; } } else { cout << "fail: no such user\n"; } } if (!(strcmp(part_str, "logout"))) { part_str = strtok(NULL, " "); compare = 1; for (j = 0; j < k; j++) { if (!(strcmp(part_str, peop[j].login))) { compare = 0; index = j; break; } } if (!compare) { if (peop[index].status) { peop[index].status = 0; cout << "success: user logged out\n"; } else { cout << "fail: already logged out\n"; } } else { cout << "fail: no such user\n"; } } } delete[] peop; return 0; } Edited by author 24.02.2015 02:52 |
| For all Who had WA9 , use Paskal and want to solve this problem without LA ! | SP2 | 1114. Boxes | 21 Feb 2015 03:10 | 4 |
Use QWORD instead of INT64! Thank you.I've got ac now. Thank you. Changed from signed int64 to unsigned int64 for c++. |
| I got the solution answer | Muzaffardjan Karaev | 1496. Spammer | 20 Feb 2015 15:12 | 2 |
https://uzdisk.uz/public.php?service=files&token=dacc643443b8fa3475306cd6b57a9277a6d354a5&file=/acm.timus.ru/1496.%20%D0%A1%D0%BF%D0%B0%D0%BC%D0%B5%D1%80.cpp #include <iostream> #include <string> #include <algorithm> using namespace std; int n; string array[10001]; struct TSpamer { string name; short index; }Spamer[10001]; void my_sort(int j) { int ind = 0; int Min_element = Spamer[ind].index; for(int i=0; i<j; i++) { int l = 0; while(l < j) { if(Spamer[l].index <= Min_element) { Min_element = Spamer[l].index; ind = l; } l++; } cout << Spamer[ind].name << endl; Min_element = 101; Spamer[ind].index = 102; } return; } int main(void) { int counter = 1; cin >> n; for(int i=0; i<n; i++) cin >> array[i]; sort(array, array+n); int k = 0, j = 0; while(k < n-1) { for(int i=k+1; i<n; i++) if(array[k] == array[i]) counter++; if(counter > 1) { Spamer[j].index = counter; Spamer[j].name = array[k]; j++; } k += counter; counter = 1; } my_sort(j); return 0; } Edited by author 16.10.2013 20:53 check my sol :P #include <iostream> #include <set> #include <string> using namespace std; int main () { string a[103]; set<string> gh; int n; cin >> n; for(int i = 0; i < n; i++)cin >> a[i]; for(int i = 0; i < n - 1; i++){ for(int j = i + 1; j < n; j++) if(a[i] == a[j]){gh.insert(a[i]);} } while (!gh.empty()){ cout << *gh.begin() << "\n"; gh.erase(gh.begin());} } Edited by author 20.02.2015 15:18 |
| wrong answer #7. | Bahodir | IT of TUIT | | 1796. Amusement Park | 19 Feb 2015 02:51 | 1 |
Please give me test...My code : import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Park1796_ { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int a[] = new int[6]; int max = 999999999, k = 0; for (int i = 0; i < a.length; i++) { a[i] = in.nextInt(); if (a[i] != 0 && a[i] < max) { max = a[i]; k = i; } } int b = in.nextInt(); int sum = 0; sum += a[0] = 10 * a[0]; sum += a[1] = 50 * a[1]; sum += a[2] = 100 * a[2]; sum += a[3] = 500 * a[3]; sum += a[4] = 1000 * a[4]; sum += a[5] = 5000 * a[5]; switch (k){ case 0: k = 10; break; case 1: k = 50; break; case 2: k = 100; break; case 3: k = 500; break; case 4: k = 1000; break; case 5: k = 5000; break; } int l = 0, d = sum - k; int count = 0, f = 0; f = d / b + 1; while (f * b <= sum && f * b >= d){ out.print(f + " "); count++; f++; } System.out.println(count); out.flush(); } } Edited by author 19.02.2015 03:01 |
| I need you help, nice folks...Its not working in Java..its correct | Farruh-WIUT | 1877. Bicycle Codes | 19 Feb 2015 02:37 | 1 |
import java.util.Scanner; public class JavaThieves877 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int c1 = Integer.parseInt(scanner.next()); int c2 = Integer.parseInt(scanner.next()); if (c1 % 2 == 0 || c2 % 2 != 0) { System.out.print("Yes"); } else if (c1 % 2 != 0 || c2 % 2 == 0) { System.out.print("No"); } } } |
| A simple way to correct solution | olpetOdessaONU [1 2/3] | 1133. Fibonacci Sequence | 18 Feb 2015 14:27 | 4 |
If you use formula in C++, you don't need the long arithmetics. Use long double and you'll get AC. i used long double, 2 4 6 29 -1000 but my answer is -6.00693e+208, is it correct or not? you should turn off siencetific notation My approach goes like this: lets choose a big random prime P > 10^16, and calculate F_(i+1)%P. |
| bits/stdc++.h (TLE) vs stdio.h (AC) | Dijkstraido | 1048. Superlong Sums | 17 Feb 2015 01:48 | 1 |
bits/stdc++.h -> TLE on Test #4 cstdio -> TLE on Test #4 stdio.h -> AC Compiled with: G++ 4.9 C++11 Can anyone give an explanation? |
| why my code got WA #2 ? | vladimir | 1049. Brave Balloonists | 15 Feb 2015 23:30 | 2 |
var podschet,a,b,i:integer; begin a:=1; for i:=1 to 10 do begin readln(b); a:=a*b; end; for i:=1 to a do begin if a mod i=0 then podschet:=podschet+1; end; if podschet>9 then podschet:=podschet div 10; writeln(podschet); end. Edited by author 11.12.2014 15:46 Mistake is in this line: if podschet>9 then podschet:=podschet div 10; To take last digit you should be using mod instead of div. Edited by author 15.02.2015 23:31 Edited by author 15.02.2015 23:31 |
| Work fine on my computer, returns "wrong answer" here (Python 3.3). | ipeterov | 1001. Reverse Root | 15 Feb 2015 23:30 | 2 |
Here's my code: import math a = input() a = a.replace('\n', ' ') a = a.split() a.reverse() for i in a: print(math.sqrt(float(i))) Edited by author 10.05.2014 16:59 What we are inputting is a stream of inputs, that may contain '\n'. On the other hand, input() cannot contain newline character. |
| problem 1068 wrong answer?? | sar | 1068. Sum | 15 Feb 2015 21:02 | 1 |
#include<iostream> using namespace std; int main() { long int N,i,sum=0; cin >> N; if (N > 10000 || N < -10000) { cout<<sum; return 0; } if(N>0) for(i= N; i>= 1; i-- ) sum=sum+i; if(N<0) for(i= N; i<=1; i++) sum=sum+i; cout<<sum; } |
| The projection? | GeoSer | 1388. Photo | 15 Feb 2015 14:40 | 1 |
What kind of projection? Orthographic or perspective? Edited by author 15.02.2015 14:43 |
| whats wrong with my codes?? WA #10 | mehdi_wm | 1787. Turn for MEGA | 15 Feb 2015 12:01 | 1 |
import java.util.*; public class TurnForMEGA { public static void main(String[] args) { Scanner in=new Scanner(System.in); int k=in.nextInt(); int n=in.nextInt(); int sum=0,temp=0; int result=0; int[] array =new int[100]; for(int i=0;i<n;i++){ array[i]=in.nextInt(); } for(int i=0;i<n;i++) { temp=array[i]-k; if(temp>0) { array[i+1]+=temp; } } result=array[n-1]-k; if(result<=0) { result=0; } System.out.print(result); }
} Edited by author 15.02.2015 12:16 Edited by author 15.02.2015 12:16 |
| all 3 digit numbers would be lucky | nikhil | 1044. Lucky Tickets. Easy! | 15 Feb 2015 05:18 | 3 |
according to the language of question sum of 1st 3 digits must be equal to the sum of last three digits for a number to be lucky. so am i missing some point? please help! According to statement digit count must be divisible by 2, source: "Output should contain a number of tickets such that the sum of the first half of digits is equal to the sum of the second half of digits." |
| WA#3 : use long long, sum > n*3 | ACSpeed | 1688. Team.GOV! | 12 Feb 2015 22:24 | 2 |
|
| WA c++ help | Barbs | 1607. Taxi | 12 Feb 2015 18:46 | 1 |
#include <iostream> using namespace std; int main(){ int a,b,c,d,k=0; cin >> a >> b >> c >> d; while(a<c){ if(k==0){ k = 1; a += b; cout << a << " "; } else { k = 0; c -= d; cout << c << " "; } } cout << a ; return 0; } |
| Accepted sqrt_decom && binary_search && quick sort 0.765 | Temirbay Miras | 1613. For Fans of Statistics | 12 Feb 2015 10:15 | 1 |
|