Общий форумHi. I find out that test #3 looks like this : p = 3 V = 4 n = 0 When we need to find T, answer will be "undefined" if and only if n = 0 (because, in this way, we get division by zero). In second and in third tests n=0, and we need to find T. I wrote code like this : if( we need find T ) { if( n==0 ) printf("undefined\n"); } But, in this way, I get WA 3. What is wrong? Please, check test, or, if I made mistake, help me figure it out. Thanks. Edited by author 16.07.2012 01:48 the answer is "error" because there is no solution Edited by author 21.08.2012 15:16 But in this case I get WA 2, changing only one string in my code. "Write the number that will appear in the window of the magic machine after the rotation." I think 'number' is not a correct definition of a sequence of digits with possible leading zeros. So 8907712345 is number, but 0771234589 is not. So I propose to replace 'number' with 'sequence of digits'. And what the meanging about the number under"Test #" ? Если у вас TL 21 то попробуйте тест у которого корень с 19999 сыновей. Это именно такой тест Edited by author 15.06.2010 15:54 #include <stdio.h> #include <conio.h> #include<string.h> #include <stdlib.h> int main () { char n[4],m[4]; int a,b;
scanf("%s%s",&n,&m); a=atoi(n); b=atoi(m); if(a==0 || a%2==0 || b%2==1 ) printf("yes"); else printf("no"); getch(); return 0 ;
} this is my code so what is the crash error # include <iostream> # include <vector> using namespace std; const int maxN=10000+10; int p[maxN],t[maxN]; vector <int> v; int main () { int n,sum=1;
for (int i=2;i<=maxN;i++) for (int j=2*i;j<=maxN;j+=i) p[j]=1; for (int j=1;j<=10;j++) { cin>>n; for (int i=2;i<=n;i++) { int len = n; while (len>1 && !p[i] && len%i==0) { len/=i; v.push_back(i); } } }
for (int i=0;i<v.size();i++) t[v[i]]++; for (int i=2;i<maxN;i++) if (t[i]>0) { t[i]++; sum*=t[i]; sum%=10; } cout<<sum%10; //cin>>n; return 0; } You have some trash in this test after the usefull part. So, my multitest failed it firstly. i also use suffix array.but i can ac it. It's O(nlogn + n). What is different with case #15. My program runs good for 14 tests. import java.io.*; import java.util.Scanner; public class string { public static void main(String args[]) throws IOException { Scanner sc = new Scanner(System.in); BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); String each; int m=0,l=0,e=0; int num = sc.nextInt(); for(int i=0;i<num;i++) { each = bufferedreader.readLine(); if(each.charAt(0)=='M') { m++; } else if(each.charAt(0)=='L') { l++; } else if(each.charAt(0)=='E') { e++; } } if((m>=l) && (m>=e)) System.out.println("Macaroni Penguin"); if((l>=m) && (l>=e)) System.out.println("Little Penguin"); if((e>=m) && (e>=l)) System.out.println("Emperor Penguin");
} Same question, maybe related with BufferedReader. Several times faced with this problem, any idea? Are there exactly two plates to be put on the tray or can there be more/less than two? Can someone clarify this for me? Thanks! I'm using simple DFS from every point and got TLE on 5th test. Wich algo should I use to solve it faster? Yeah, i also have this problem :) Got AC, 0.078 :) MOPDOBOPOT, it it a so easy problem, just generate all words that you can get from table, and using this list just check all words. Edited by author 04.09.2012 21:28 what is in 13 test? Maybe something like that: n=5 k=3 The correct answer is 4 Exactly n == 7 && k == 3. True answer is 5! Thanks for a great test!!! Exactly n == 7 && k == 3. True answer is 5! WRONG true answer is 6!!!! I. 3 steak = 2 sec; II. 3 steak = 2 sec; III. 1 steak = 2 sec; 2+2+2=6. Edited by author 05.07.2012 20:16 Edited by author 05.07.2012 20:16 then 3 2 should be 4 . how they are 3 U r wrong: Sec status( 0-raw, 1-one side raw, 2-ready ) 1. 111 000 0 2. 222 000 0 3. 222 111 0 4. 222 221 1 5. 222 222 2 I've just found this mistake of mine :) U r wrong: Sec status( 0-raw, 1-one side raw, 2-ready ) 1. 111 000 0 2. 222 000 0 3. 222 111 0 4. 222 221 1 5. 222 222 2 I've just found this mistake of mine :) I don't know how to solve this problem with DP, because here is just a one cycle without any cool thinking) Where is a DP here?) It's just a easy problem. Edited by author 04.09.2012 14:40 Edited by author 04.09.2012 14:40 what is test #5? why did I have wa var k,n,s,j,max:integer; a:array [0..100000] of integer; b:array [1..10] of integer; begin a[1]:=1; a[0]:=0; for k:=2 to 10000 do begin if k mod 2 =0 then a[k]:=a[k div 2] else a[k]:=a[k div 2]+a[(k div 2)+1]; end; k:=0; while not eof do begin k:=k+1; readln(b[k]); end; n:=k-1; for k:=1 to n do begin max:=0; s:=b[k]; for j:=1 to s do begin if a[j]>max then max:=a[j]; end; writeln(max); end; end. Same problem here. It gives me crash on test 5. Maybe it's something to do with the case when the input consists of only one line - 0 as it's not specified what the program should do then. Yep, same here.... crash using java on test 5. GOT AC... error was when input was repeated e.g: 10000 10000 0 Answer: 521 521 My program was crashing because of using a set. GL Edited by author 03.10.2010 06:24 where you find test cases? Guys, apparently this problem is not solvable in C#. Even it is written in FAQ: “It’s not recommended to use Java and C# for solving following problems: 1220, 1275, 1306.” Just creating half of the required array length with int gives Memory Limit Error Like using System; public class Program { private static void Main() { int[] nn=new int[125000]; } } This code gives Memory Limit Error. But some people solved in Java. To whom who solved in Java, what was the array length in your case? Does it give Memory Limit Error in Java creating 125000 elements in int type ? So should I learn C++? Is it worth it? Thanks for suggestions. Edited by author 02.09.2012 16:14 To whom who solved in Java or C#, Could you please send me the algorithm or solution to fakel2005@gmail.com Thanks a lot I’m sorry I’m obsessed with this problem using System; public class Program { private static void Main() {
} } Why this code gives me “Memory Limit Exceeded?” I’m not doing anything here. How is it even possible then writing something in it and expecting not to get MLE? I have a question, if you submit those codes who solved in C# NOW, will it give AC NOW as before? What I mean is maybe C# compiler which is being used now consumes too much memory? Thanks, It works in my computer 0k... #include<iostream> #include<string.h> #include<cstdio> #include<vector> #include<cmath> using namespace std; int main(){ unsigned long long aux; vector<unsigned long long>v1; while(cin >> aux)v1.push_back(aux); int i=v1.size()-1; while(i>=0){ printf("%.4f\n",sqrt(v1[i])); i--; } } cb37c1a6-2f8c-4b8d-9b35-bb945448c8b1 cb37c1a6-2f8c-4b8d-9b35-bb945448c8b1(14) : error C2668: 'sqrt' : ambiguous call to overloaded function S:\checker\compile\vc10\include\math.h(589): could be 'long double sqrt(long double)' S:\checker\compile\vc10\include\math.h(541): or 'float sqrt(float)' S:\checker\compile\vc10\include\math.h(127): or 'double sqrt(double)' while trying to match the argument list '(unsigned __int64)' Just make vector of doubles. Everything will be OK. Error because function sqrt() gets double or long double or float parameter. |
|