|
|
Общий форумcan anyone please explain what test case 5 is i have tried many times but iam not able to pass it #include<iostream> using namespace std ; int main() { int a, b ; cout<<"Plz enter two numbers: "<<'\n' ; cin>> a >> b ; cout<<"Here is your output: "<< a + b <<'\n' ; return 0 ; } what's the wrong!!! I've written this code in c++ and submitted under visual c++2010 but they don't accept it..why????? Because you write some text in output. Remove all text. #include<iostream> using namespace std ; int main() { int a, b ; cin>> a >> b ; cout<< a + b ; return 0 ; } Like this thanks for your answer :) Что не так с моей прогой? На третьем тесте дает не правильный ответ. (What is wrong with my program? It is wrong on the 3rd test.) #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main(void) { vector<long double> b; vector<long double>::iterator it; long double tmp; while(!cin.eof()) { cin >> tmp; b.insert(b.end(), tmp); } int ololo; cout.setf(ios::fixed); for (ololo = b.size()-2; ololo >= 0; ololo--) cout << sqrt(b[ololo]) << endl;
system("PAUSE"); return 0; } Edited by author 01.06.2014 00:19 Edited by author 10.06.2014 00:57 Could anyone give me some similar test case like test 5? I am having some problems with this one. Also, I have a question about the task. Is this situation possible: +1 +2 -2 -1 +2 -2 +1 -1 My question is pointing at this: After the first moment, first master will call mage 1 (+1) and second master will call mage 2 (+2). In the second moment, is the first master able to call mage 2 since the second master is letting the mage 2 go in the exact same moment? see this 1 6 6 2 + 1 - 1 + 1 + 2 - 1 - 2 + 1 - 1 + 2 + 1 - 1 - 2 answer: :-( My program gives correct answer for that test case but sill WA i can't figure out why. Can you give me other tests? I can't find what's wrong... I used DP, a[i][j] - true - iff Sandro begin i-th step, and Zagamius j-th. little hint: if mag[i] == mag[j] and both are '+' then a[i][j] = false. Easy problem. P.S. If you have WA#2 check this tests 3 -> 3 2 -> 2 1 -> 1 #include <stdio.h> #include <math.h> unsigned long long a[70000]; int main() { unsigned long long i,k,n,x; scanf("%ull\n",&n); for(i=0;i<n;i++) { scanf("%ull",&a[i]); } for(i=0;i<n;i++) { k=(8*a[i]-7); x=a[i]*a[i]; if(x==k) { printf("1 "); } else { printf("0 "); } } return 0; } #include <stdio.h> #include <math.h> unsigned long long a[70000]; int main() { unsigned long long i,k,n; long double x; scanf("%ull\n",&n); for(i=0;i<n;i++) { scanf("%ull",&a[i]); } for(i=0;i<n;i++) { k=(8*a[i]-7); x=a[i]*a[i]; if(x==k) { printf("1 "); } else { printf("0 "); } } return 0; } all test that i did was correct but i received Wrong answer 1. all tests that writed people i did and they was correct I have a problem when comparing real numbers private static double EPS = 0.33333333333333; public static boolean eq (double a, double b) { return Math.abs (a - b) <EPS; } when checking whether a given point belongs to a parabola, I simply substitutes the x and y the function (y = x ^ 2 * a + x * b) I can not pass the test 57 Edited by author 18.09.2012 18:13 Edited by author 27.05.2014 23:45 the fact that a decrease in EPS say up to 1E-10 then the program does not pass the test 13 Edited by author 18.09.2012 19:14 Edited by author 27.05.2014 23:46 I found a suitable number: 0.000050010002, but it is only for java (passes 62nd), for C++10 does not work, a stop on the 57th. Apparently my solution is not suitable for this task. Edited by author 27.05.2014 23:46 Set aside the alarm! Number: 1e-8. (I found on the forum) #define ┌ 218 #define ┘ 217 #define └ 192 #define ┐ 191 #define ─ 196 #define │ 179 #define N 20 #define M 50 unsigned char A[N][M + 1]; int main() { int i, j; for (i = 0; i < N; i++) { for (j = 0; j < M; j++) A[i][j] = getchar(); if (getchar() != '\n') throw 1; } } /* .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ...........┌─────┐................................ ...........│.....│................................ ....┌──────│.....│..........┌─┐................... ....│......│.....│..........│.│................... ....│......│.....│..........└─┘................... ....│......│....┌│────┐.............┌─┐........... ....│......└─────┘....│.............│.│........... ....│......│....│.....│.............└─┘........... ....│......│....│.....│.........┌──┐.............. ....└──────┘....│.....│.........│..│.............. ................│.....│.........│..│.............. ................└─────┘.........└──┘.............. .................................................. .................................................. */ Edited by author 27.05.2014 23:01 Edited by author 01.06.2014 00:29 This case was a corner usecase. This talks about the scenario where the driver offers less than what the traveller is trying to pay. Example: 11 1 10 2. Since the traveller/Petr can never do a '-' operation, he has to satisfy for 11. Thanks, ElPsyCongroo. x^2 + y^2 = A * p + k; you use this simple algorithm: A = [0....p] and simple Check: first time : y = 0 and x = sqrt(A*p + k) if(x*x == A*p + k) you should Print this answer: x and y else second time: x = (int) sqrt(A*p + k) and y = sqrt(A*p + k - (int)x*x) if(x*x + y*y == A*p + k) you should Print this answer : x and y else continue and increasing only ONE count of A Sorry my English... Edited by author 04.01.2014 13:44 Edited by author 26.05.2014 22:39 1000000000 1000000001 100000000000000000 1000000000000000000 for such kind of tests my solution works more than 10 sec, here I got AC in 0.031. I agree with you. I don`t think so! Confirming this test has to be added. My solution that got AC on the contest gets TLE on it. Use print '%.16f' % (result) instead of print result Var n:LongInt; Begin Read(n); if n in [1..4] then writeLn('few'); if n in [5..9] then writeLn('several'); if n in [10..19] then writeLn('pack'); if n in [20..49] then writeLn('lots'); if n in [50..99] then writeLn('horde'); if n in [100..249] then writeLn('throng'); if ((n>=250) and (n<=499)) then writeLn('swarm'); if ((n>=500) and (n<=999)) then writeLn('zounds'); if n>=1000 then writeLn('legion'); end. Tell input data for test number 8, please ! :) |
|
|