|
|
Common BoardMy AC solution gives wrong answer for this test case: 1/2 - 1/3 my answer: -1/6 Add this test... Пример в задаче неправильный. Исправьте стоимость на 111. Example isn't correct. Change cost from 114 to 111. Oh, how clever you are! 5000+ authors ACed this very difficult problem, and only you noticed the incorrect example. Are you counted it? ahhaha you are very patient It is correct. The answer is 114. switch(in.sval) { case "register": { in.nextToken(); log=in.sval; if(log==null) log=Integer.toString((int)in.nval); in.nextToken(); pas=in.sval; if(pas==null) pas=Integer.toString((int)in.nval); if(m.containsKey(log)) out.println("fail: user already exists"); else { m.put(log,pas); out.println("success: new user added"); } } break; case "login": { in.nextToken(); log=in.sval; if(log==null) log=Integer.toString((int)in.nval); in.nextToken(); pas=in.sval; if(pas==null) pas=Integer.toString((int)in.nval); if(!m.containsKey(log)) out.println("fail: no such user"); else if(!m.get(log).equals(pas)) out.println("fail: incorrect password"); else if(a.contains(log)) out.println("fail: already logged in"); else { a.add(log); //out.println(m.get(log) + " " + pas); out.println("success: user logged in"); } } break; case "logout": { in.nextToken(); log=in.sval; if(log==null) log=Integer.toString((int)in.nval); if(!m.containsKey(log)) out.println("fail: no such user"); else if(!a.contains(log)) out.println("fail: already logged out"); else { a.remove(log); out.println("success: user logged out"); } } break;
} Got WA on test 16. I've read previos posts about test "123", i have base 4 for this test. var a:array[1..101] of string; b:array[1..101] of integer; k,n,i,j,t,max,p:integer; x:string; begin k:=1; readln(n); readln(x); a[1]:=x; for i:=2 to n do begin readln(x); for j:=1 to k do if x=a[j] then b[j]:=b[j]+1; for j:=1 to k do if x<>a[j] then a[k+1]:=x; k:=k+1; end; for t:=1 to n do if b[t]>=max then max:=b[t]; for p:=1 to n do if b[p]=max then writeln(a[p]); end. #include<stdio.h> void main() { int harry, larry; int sum; int harryleft, larryleft; scanf("%d%d", harry, larry); sum = (harry + larry)-1; harryleft = sum - harry; larryleft = sum - larry; printf("%d%d", harryleft, larryleft); return 0; } Here's the necessary changes: int main() scanf("%d%d", &harry, &larry); I passed it, there was an defect in my algo :-) Edited by author 30.04.2015 23:51 #include <iostream> using namespace std; int n,A[1002],i,maxi,S[1002],st,dr,rez; int main() { cin>>n; for(i=1;i<=n;i++) cin>>A[i]; S[1]=A[1]; for(i=1;i<=n;i++) if(S[i-1]<=0) S[i]=A[i]; else S[i]=A[i]+S[i-1]; rez=-1000000; for(i=1;i<=n;i++) if(S[i]>rez) rez=S[i]; cout<<rez; return 0; } it's just a joke, isn't it? You have to use StringComparer with parameter StringComparison.Ordinal to pass WA7 in CSharp. I've got AC in this way. I dont understand why i get WA # 8 please help me. I write program,but I can not test it, because I dont know how to enter a test. for i := 1 to n do readln(s[i]); use standart windows notepad when you press CTRL you can can use numpad to enter ASCII Codes of symbols open notepad: press ALT press 2 on numpad (digit keyboard on rigth side of keyboard) press 1 press 8 release ALT and you see Edited by author 15.09.2007 00:29 This is the sample input:(just copy it and look it in DOS) .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ...........谀哪哪?............................... ...........?....?............................... ....谀哪哪某.....?.........谀?.................. ....?.....?....?.........??.................. ....?.....?....?.........滥?.................. ....?.....?...诔哪哪?............谀?.......... ....?.....滥哪哪?...?............??.......... ....?.....?...?....?............滥?.......... ....?.....?...?....?........谀目.............. ....滥哪哪馁....?....?........?.?............. ................?....?........?.?............. ................滥哪哪?........滥馁.............. .................................................. .................................................. Edited by author 08.12.2007 17:30 Edited by author 08.12.2007 17:30 by the way you can use font "lucida console" or "terminal" I use #ifndef ONLINE_JUDGE in C and read the input in the same format as the output should look like, then draw the squares with C code in my program - makes testing much easier. Set you console encoding 1252 before input(c++ : system("chcp 1252");) Copy past below. Do not change encoding of browser (it should be UTF-8), other way it convert to 2 byte sequence. You can try to copy this to standard windows notepad. If using Notepad++, set encoding to UTF8 before paste. Should work. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ...........ÚÄÄÄÄÄ¿................................ ...........³.....³................................ ....ÚÄÄÄÄÄij.....³..........ÚÄ¿................... ....³......³.....³..........³.³................... ....³......³.....³..........ÀÄÙ................... ....³......³....Ú³ÄÄÄÄ¿.............ÚÄ¿........... ....³......ÀÄÄÄÄÄÙ....³.............³.³........... ....³......³....³.....³.............ÀÄÙ........... ....³......³....³.....³.........ÚÄÄ¿.............. ....ÀÄÄÄÄÄÄÙ....³.....³.........³..³.............. ................³.....³.........³..³.............. ................ÀÄÄÄÄÄÙ.........ÀÄÄÙ.............. .................................................. .................................................. Additional input: .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ...........ÚÄÄÄÄÄ¿................................ ...........³.....³................................ ....ÚÄÄÄÄÄij.....³......ÚÄ¿ÄÚÄ¿................... ....³......³.....³......³.³.³.³................... ....³......³.....³......ÀÄÙÄÀÄÙ................... ....³......³....Ú³ÄÄÄÄ¿.............ÚÄ¿........... ....³......ÀÄÄÄÄÄÙ....³.............³.³........... ....³......³....³.....³.............ÀÄÙ........... ....³......³....³.....³.........ÚÄÄ¿.............. ....ÀÄÄÄÄÄÄÙ....³.....³.........³..³.............. ................³.....³.........³..³.............. ................ÀÄÄÄÄÄÙ.........ÀÄÄÙ.............. .................................................. .................................................. Edited by author 28.04.2015 07:40 Be careful to check if the two cards in Dima's sleeve are the same! The compiler is Microsoft ® Visual C# 2005 Compiler version 8.00.50727.42 (.NET Framework 2.0). The most of problems can be solved using C#, except for those that can't be solved with Java (1220, 1275, 1306). Edited by author 31.12.2006 01:31 using System; public class Sum { public static void Main() { string[] tokens = Console.ReadLine().Split(' '); Console.WriteLine(int.Parse(tokens[0]) + int.Parse(tokens[1])); } } If you need to read or write double in your program, do not forget set culture to InvariantCulture: Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; In some problems numbers are not necessarily separated with single space. Use Console.ReadLine().Split(new char[] {' ', '\t'}, StringSplitOptions.RemoveEmptyEntries) instread of Console.ReadLine().Trim().Split(' ') C# compiler has been updated to Microsoft Visual C# 2008 version 3.5.30729.1 (.NET Framework 3.5) The default decimal separator is now set to “.” All C# submissions to problems with floating-point numbers in input or output were rejudged. The verticts of about 800 submissions of 100 authors were changed. I have try to make some optimisation of input-output, but native read of stream does not bring some significant effect, and try of use Win32 api functions faults with runtime error on test 1 of task 1000. Where is the way to looking for? All of my home-made tests have been passed succesfully but what is the test 10 which gives an error? How to get the test and what result should be for it? Edited by author 26.04.2015 18:07 Hi, I have a solution which seems correct. For the first test it gives me the following answer: 4 1 4 5 6 I consider, it fits to the problem statement. Could anyone clarify, what is going wrong? My algorithm is based on BFS and I always mark start vertex in a connected component as a first team vertex. int main() { // ios_base::sync_with_stdio(false); int n,sum; while(cin>>n) { sum=0; if(n<0) for(int i=1; i>=n; i--) sum+=i; else sum=(n*(n+1))/2; cout<<sum<<endl; } return 0; } 3 a() : int a(int) : real a(real) : int 3 int x = a() auto y = a(x) auto z = a(y) WA14 program says Error on line 3: No such function But right answer is y : real z : int please write the 5 test. I got wrong answer It must be N=10; But i dont know answer for N=10 Epsilon... Precision... Who cares, huh? Edited by author 19.10.2013 21:33 Thanks Leonid I should learn to pay attention! My email is 843539450@qq.com,Thank you very much~ Cos My English is Bad I don't Understand this Problem PS. Thank you Here is tests 1 _ 10 2 _ 45 3 _ 165 5 _ 1287 6 _ 3003 11 -> 75501 15 -> 478731 20 -> 2714319 45 -> 40051495 Please provide some more tests who have passed the problem 30 - 22505751 40 - 45433800 50 - 25614639 |
|
|