| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| WA #1 Please help! | Rouk | 1274. Fractional Arithmetic | 16 авг 2012 15:05 | 1 |
Hello! The code works correctly. Checked on many examples. Most likely something with input-output. Prompt, where it is wrong and how it is better to make fraction input? Code C++ Sorry for Russian comments //структура дроби struct Fractional { //объявление целой части, числителя и знаменателя long long intPart, numerator, denomerator; } _oneFract, _twoFract, _result; //функция считывания дроби Fractional ReadFractional() { Fractional _fract; //переменная _razdel определяет, что ввели: только целую часть, только дробную часть или целую и дробную часть char _razdel; //считываем первое число scanf("%lld%c",&_fract.intPart, &_razdel); //считываем разделитель после первой цифры: если нажат Enter, то число без дробной части, //если слеш, то только дробная часть, если пробел то и целая и дробная части присутствуют if (_razdel == '\n') { _fract.numerator = 0; _fract.denomerator = 1; } else if (_razdel == ' ') { //Считываем дробную часть scanf("%lld/%lld%*c", &_fract.numerator, &_fract.denomerator); if (_fract.denomerator == 0) _fract.denomerator = 1; } else if (_razdel == '/') { //Считываем знаменатель scanf("%lld%*c", &_fract.denomerator); if (_fract.denomerator == 0) _fract.denomerator = 1; _fract.numerator = _fract.intPart; _fract.intPart = 0; } //Сбрасываем входной поток fflush(stdin); return _fract; } |
| WA 5 | Avtandil Gokadze | 1752. Дерево 2 | 16 авг 2012 14:37 | 1 |
WA 5 Avtandil Gokadze 16 авг 2012 14:37 |
| 2ADMINS: condition ambiguities | melkiy | 1039. Юбилейная вечеринка | 16 авг 2012 13:40 | 2 |
It is not clear at least 2 points: 1) "The output should contain the maximal total rating of the guests." President is the host, not a guest, so his rating is excluded. (?) 2) As the party is the president's anniversary he cannot absent. (?) Am i right? If not, correct the condition please. Answers to questions 1) President's rating should be included if he goes 2) President may not be at a party 3) Noone may go to the party P.S. I'm not an admin :) |
| Urra | coder | 1596. Кошмарный конь | 16 авг 2012 12:40 | 4 |
Urra coder 24 июл 2012 17:38 Re: Urra Neofit [BANNED] 25 июл 2012 09:42 How to solve it? What idea? Re: Urra Neofit [BANNED] 25 июл 2012 10:19 my be need to delete this link :)) |
| Помогите! В чем проблема? | yura | 1068. Сумма | 16 авг 2012 09:34 | 2 |
import java.util.Scanner; public class my9 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Введите n"); int n=sc.nextInt(); int s=0; if ((n>0) & (Math.abs(n)<=10000)) { for (int i=1;i<=n;i++) s=s+i; } else if ((n<=0) & (Math.abs(n)<=10000)) { for (int i=n;i<=1;i++) s=s+i; } System.out.println(s); } } Убери строку : System.out.println("Введите n"); Можно вывести только ответ. |
| JAVA - What's wrong with my solution (Crashed) | JOLO_ | 1023. Пуговицы | 16 авг 2012 02:27 | 2 |
public class Buttons { public static void main(String[] args) { //convert parameter into int int N = 0; try { N = Integer.parseInt(args[0]); } catch(NumberFormatException ignore) {} //find L for(int i = 3; i < Math.sqrt(N); i++) { if(N%i == 0) { System.out.println(i-1); System.exit(1); } } System.out.println(N-1); } } P.S. On my computer it works perfectly Numbers are read from stdin |
| WA on test #1 | Rouk | 1274. Fractional Arithmetic | 15 авг 2012 17:19 | 1 |
Please help me! I think the problem with the input / output. post the code sorry for the Russian comments. INPUT //структура дроби struct Fractional { //объявление целой части, числителя и знаменателя long long intPart, numerator, denomerator; } _oneFract, _twoFract, _result; //функция считывания дроби Fractional ReadFractional() { Fractional _fract; //переменная _razdel определяет, что ввели: только целую часть, только дробную часть или целую и дробную часть char _razdel; //считываем первое число scanf("%lld",&_fract.intPart); //считываем разделитель после первой цифры: если нажат Enter, то число без дробной части, //если слеш, то только дробная часть, если пробел то и целая и дробная части присутствуют scanf("%c", &_razdel); if (_razdel == '\n') { _fract.numerator = 0; _fract.denomerator = 1; } else if (_razdel == ' ') { //Считываем дробную часть scanf("%lld/%lld", &_fract.numerator, &_fract.denomerator); if (_fract.denomerator == 0) _fract.denomerator = 1; } else if (_razdel == '/') { //Считываем знаменатель scanf("%lld", &_fract.denomerator); if (_fract.denomerator == 0) _fract.denomerator = 1; _fract.numerator = _fract.intPart; _fract.intPart = 0; } //Сбрасываем входной поток fflush(stdin); return _fract; } OUTPUT if (_result.intPart == 0) { if (_result.numerator == 0) { printf("0"); } else { printf("%lld/%lld", _result.numerator, _result.denomerator); } } else if (_result.numerator == 0) { printf("%lld",_result.intPart); } else { printf("%lld %lld/%lld",_result.intPart, _result.numerator, _result.denomerator); } The answers are checked and correct Edited by author 15.08.2012 17:22 |
| what is test 1????? | emkeb1371 | 1001. Обратный корень | 15 авг 2012 16:21 | 2 |
|
| Please help! Time limit exceeded! | Grigorenko Vlad | 1021. Таинство суммы | 15 авг 2012 15:35 | 7 |
#include<stdio.h> int main(void){ long n,m,i,j; int flag; int A[50001],B[50001]; scanf("%ld",&n); for(i=1;i<=n;i++) scanf("%d",&A[i]); scanf("%ld",&m); for(j=1;j<=m;j++) scanf("%d",&B[j]); flag=0; for(i=1;i<=n;i++) for(j=1;j<=m;j++) if(A[i]+B[j]==10000) flag=1; if(flag) printf("YES"); else printf("NO"); return 0; } not an optimal algo... O(n^2), this problem can be solved with O(n+m) you should think a little more. If you need code, send an email on andrewshmig@gmail.com Edited by author 06.05.2012 00:27 or u can use BinarySearch to search second value. for example in the first test: 1) u take -175 value, 2) try to find 10175 in second list (using binary search) (because -175 + 10175 == 10000) ... good luck! Edited by author 08.05.2012 00:20 >not an optimal algo... O(n^2), this problem can be solved with O(n+m) This problem can be solved with O(n). ) Edited by author 02.06.2012 20:52 Use the associative containers you can use HashSet, it's faster use the two-pointers method or boolean set. It's enough fast for this problem. |
| why WA on test14~Always>?<? | Heng | 1299. Псилонцы | 15 авг 2012 12:50 | 1 |
|
| I need help ! Prompt please! | Buer | 1810. Антиуравнения | 14 авг 2012 18:29 | 2 |
if det(A) == 0 , what should I do ? If A - is not square matrix ( i.e. k != n ), how to calculate det(A) ? |
| Any fast solutions? | YSYMYTH | 1144. The Emperor's Riddle | 14 авг 2012 15:40 | 1 |
If so, please send one to ysymyth@gmail.com please! |
| First test doesn't fit the statement limitations! (+) | Yermak | 1526. Martian Plates | 14 авг 2012 00:03 | 7 |
#include <stdio.h> int p,t,n,m; int main() { scanf("%d%d%d%d",&p,&t,&n,&m); if (p<2 || p>10000 || t<2 || t>200 || (t&1) || n<1 || n>10 || m<1 || m>100) return 1/(p-p); return 0; } This program gets "Crash (integer division by zero)" at test #1. http://acm.timus.ru/status.aspx?space=1&num=1526You are right, m = 0 in the 1st test. This limitation in the problem statement is fixed now. But there is a division by zero in his code! Sandro, why did you delete my post? Because the solution of Yermak is a input validator. If the system verdict on some test is Crash (division by zero), then this test is incorrect. If the test is correct, system verdict should be Wrong Answer. Sandro, look at this line of his code! There is a division by zero if condition is true, because p-p = 0! if (p<2 || p>10000 || t<2 || t>200 || (t&1) || n<1 || n>10 || m<1 || m>100) return 1/(p-p); Edited by author 13.08.2012 11:55 Captain Obvious to the rescue! Noob, oh, i understand. Edited by author 14.08.2012 00:04 |
| stuck on 49 TLE ( and only one who get wa on 46 :) ) | qulinxao | 1198. Коррупция | 13 авг 2012 20:49 | 2 |
is graph just full on 49 test? probably nop , cose i test prog on full 2000 less then .1sec |
| I solve with simple recursion!!!! | coder | 1381. Тараканы в здании | 13 авг 2012 14:47 | 1 |
after 2 days, found DP solution, and AC with 0.046 s. Edited by author 15.08.2012 16:07 |
| what's then test3 | swx | 1038. Проверка орфографии | 13 авг 2012 13:38 | 2 |
|
| How to read data in pascal? | MOPDOBOPOT (USU) | 1050. Подготавливая статью | 13 авг 2012 11:45 | 1 |
I tried to read data string by string and then by characters but in both cases I got Crash(access violation) on 1st test :( |
| No subject | Andrey Pikas [Yaroslavl SU] | 1363. Полутона | 13 авг 2012 02:14 | 1 |
No subject Andrey Pikas [Yaroslavl SU] 13 авг 2012 02:14 Edited by author 18.08.2012 20:30 |
| all tests worked, but! | Peca | 1080. Раскраска карты | 12 авг 2012 18:35 | 6 |
Dear all, all tests I found in this discussion worked, but when I run my code I do have WA on test 7 (or 13 for another version of my code). Can someone please give a kind of inputs with some test? I checked everything I could think of and it worked. Thank you! Input: 4 4 0 3 0 4 0 0 Output: 0101 Thank you for the answer. The following tests are working, but when I submit I do have WA2. I. 3 2 0 3 0 0 result: 010 II. 4 4 0 3 0 4 0 0 result: 0101 III. 5 2 5 0 3 0 4 0 5 0 0 result:-1 IV. 5 2 3 4 5 0 0 0 0 0 result: 01111 V. 6 2 4 6 0 3 5 0 4 6 0 5 0 0 0 result: 010101 VI. 0 result :-1 I am using bfs, of course with a queue implementation. Hmm, but I used dfs and have no problems :) Maybe I will try also dfs. I still do not understand why bfs would not work (well a little modified). It seems that I have now WA#2. Does somebody knows test #2 (except those written above.)? Thank you. I have got accepted with a version of bfs modified. I also found the problem in my implementation. Once I succeeded for test below and all others from above, I got AC. Thank you for your help. 6 2 3 0 4 0 5 0 6 0 6 0 0 result: 011001
|
| WA 15 | Anton Chaplygin [Kungur][USU] | 1793. Тарелки 2 | 11 авг 2012 23:32 | 2 |
WA 15 Anton Chaplygin [Kungur][USU] 11 авг 2012 20:58 If you have WA15, you should think about the height of the plate and the height of the box. Re: WA 15 Andrew Sboev [USU] 11 авг 2012 23:32 I don't think so. I think about it and I have WA15. |