Общий форумimport java.io.*; public class D { public static void main (String args []) throws Exception { BufferedReader d = new BufferedReader(new InputStreamReader(System.in)); String v = d.readLine(); BufferedReader e = new BufferedReader(new InputStreamReader(System.in)); String c = e.readLine(); try { int a = Integer.parseInt(v); int b = Integer.parseInt(c); System.out.print(a+" ");System.out.println(b); System.out.print(b-1+" ");System.out.print(a-1); } catch(Exception e1) {System.out.println("Error translating text to int");} System.out.println(); } } I do smth wrong? Read FAQ how to input numbers Read FAQ how to output answer You used Java, that's what's wrong. Friendoship!!! What is wrong???? #include <math.h> #include <stdio.h> int main(){ int larry, herry,sum; scanf ("%i %i", &larry, &herry); sum=larry+herry; if (sum==11){ printf ("%i %i", herry-1, larry-1); } else printf ("wrong"); return 0; } Because your output only supports the example given in the problem statement. If the sum is NOT 11, your program will fail. Eliminate the "if", and use your first printf. Разрешается ли набирать высоту за время меньшее чем t? No comments Почему в ваших тестах при максимальной скорости подъёма в 50, вы поднимаетесь со скоростью в 80? (тест первый, другие не знаю) No comments Why no comments? :) Because questions either have no sense or have answers in statement. почаму в тесте минималка 125 секунд как так ? мин же будет 200 поделитесь кто нибудь своим опытом The key is noticing that the plane may change speeds, as noted in the problem, and changes speeds instantly. Edited by author 29.10.2011 13:54 Edited by author 29.10.2011 13:54 Edited by author 29.10.2011 13:55 #include<iostream> #include<stdio.h> #include<math.h> using namespace std; double distance(double x1, double y1, double x2, double y2); int main(){ int n ; double r; cin>>n>>r; double x1,y1,x2,y2; cin>>x1>>y1; cin>>x2>>y2; double ans = 0; //float pi = (float)22/(float)7; double pi=2*acos(0.0); //cout<<pi<<endl; ans = distance(x1,y1,x2,y2); //cout<<ans<<endl; int temp = n; temp = temp-2; double x3,y3; x3=x2; y3=y2; while(temp>0){ x2=x3; y2=y3; cin>>x3>>y3; ans = ans + distance(x2,y2,x3,y3); // cout<<ans<<endl; temp--; } ans = ans + distance(x1,y1,x3,y3); //distance of last and first point double con = 2*pi*r; ans = ans + con; cout.precision(2); cout<<fixed<<ans<<endl; return 0; } double distance(double x1, double y1, double x2, double y2){ x1 = x1-x2; y1 = y1-y2; x1 = x1*x1; y1 = y1*y1; double sum = x1+y1; sum = sqrt(sum); return sum; } try this test 1 1 0.0 0.0 //float pi = (float)22/(float)7; - lol :-)))) Thanks :) I was trying all sorts of things actually with the value of pi lol :P What's the expected output for this? 1 1 0.0 0.0 but i've trid this still its wrong. even it gives wrong on test 1 use array of N queues Edited by author 25.08.2011 19:25 kkk, i figured out about the LCMs pretty much myself, but i just keep getting WAs on tests like 4 or 3 and that's sooo embarassing <code> #include <stdio.h> #include <cmath> #include <set> using namespace std; long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return (a / gcd(a,b) * b); } int main() {
int n;
scanf("%d", &n);
set<int> ds; // a usual stl set which stores the distaces of all elements int tmp; for(int i=1;i<n+1;i++) { scanf("%d", &tmp); ds.insert(abs(i-tmp)); }
long long res; if(ds.size() == 1 && ds.count(0)) res = 1; else { if(ds.count(0)) ds.erase(ds.find(0)); res = 1; for (set<int>::iterator it = ds.begin(); it != ds.end(); ++it) { res = lcm(res,*it); } }
printf("%lld", res);
} </code> And the worst thing is I just can't think of a straightforward test for which that gives a wrong answer. 5 4 1 5 2 3 => 6 1 1 => 1 5 1 2 3 4 5 => 1 6 6 5 3 4 2 1 => 15 didn't check for ns like 100 and i don't think that's the problem. also i don't think the problem is about malformed longlong operation, cause if i replace that with ints the WAs are all the same. would really like if someone helped me 'bout that (( Edited by author 28.11.2011 19:38 "Every problem has a simple, fast and wrong solution." - that one is soooo right :D i mean, i came up with the distances of the items, but those actually should be the lengths of cycles )) it was like 4 1 5 2 3 => 3 2 1 2 2 but should be like 4 1 5 2 3 => 3 3 2 3 2 - and it's really straightforward to figure out how it works :D the worst thing about my initial solution is that it worked in some trivial cases :) now i made something like that: [code deleted] and finally got AC after 23 WAs :) so happy 'bout that Edited by moderator 04.12.2019 20:47 Look out for left over debug prints! I was tearing my hair out over WAs after I figured out doing the LCM of all the unique cycle counts and was convinced the approach was correct, and I was right! But one left over debug print messed me up until I finally saw it. Here is my own testing program ... Now tell me please what is wrong here??? N ==0 Q == 10 N ==1 Q == 1 N ==2 Q == 2 N ==3 Q == 3 N ==4 Q == 4 N ==5 Q == 5 N ==6 Q == 6 N ==7 Q == 7 N ==8 Q == 8 N ==9 Q == 9 N ==10 Q == 25 N == 11 -1 N ==12 Q == 26 N == 13 -1 N ==14 Q == 27 N ==15 Q == 35 N ==16 Q == 28 N == 17 -1 N ==18 Q == 29 N == 19 -1 N ==20 Q == 45 N ==21 Q == 37 N == 22 -1 N == 23 -1 N ==24 Q == 38 N ==25 Q == 55 N == 26 -1 N ==27 Q == 39 N ==28 Q == 47 N == 29 -1 N ==30 Q == 56 N == 31 -1 N ==32 Q == 48 N == 33 -1 N == 34 -1 N ==35 Q == 57 N ==36 Q == 49 N == 37 -1 N == 38 -1 N == 39 -1 N ==40 Q == 58 N == 41 -1 N ==42 Q == 67 N == 43 -1 N == 44 -1 N ==45 Q == 59 N == 46 -1 N == 47 -1 N ==48 Q == 68 N ==49 Q == 77 N ==50 Q == 255 N == 51 -1 N == 52 -1 N == 53 -1 N ==54 Q == 69 N == 55 -1 N ==56 Q == 78 N == 57 -1 N == 58 -1 N == 59 -1 N ==60 Q == 256 N == 61 -1 N == 62 -1 N ==63 Q == 79 N ==64 Q == 88 N == 65 -1 N == 66 -1 N == 67 -1 N == 68 -1 N == 69 -1 N ==70 Q == 257 N == 71 -1 N ==72 Q == 89 N == 73 -1 N == 74 -1 N ==75 Q == 355 N == 76 -1 N == 77 -1 N == 78 -1 N == 79 -1 N ==80 Q == 258 N ==81 Q == 99 N == 82 -1 N == 83 -1 N ==84 Q == 267 N == 85 -1 N == 86 -1 N == 87 -1 N == 88 -1 N == 89 -1 N ==90 Q == 259 N == 91 -1 N == 92 -1 N == 93 -1 N == 94 -1 N == 95 -1 N ==96 Q == 268 N == 97 -1 N ==98 Q == 277 N == 99 -1 N ==100 Q == 455 N == 101 -1 N == 102 -1 N == 103 -1 N == 104 -1 N ==105 Q == 357 N == 106 -1 N == 107 -1 N ==108 Q == 269 this program fails (WA) at test 8 this program shouldn't fail... Edited by author 23.11.2010 22:39 #include<iostream> int main() {
int a, b; bool t = true; std::cin >> a; if(a < 0 || a > 109){ std::cin >> a; } int k = 6, j = 9, i = 9, test = 4; while(test >= 1){ k = 5; while(k >= 1){ i = 9; while(i >= 2){ j = 9; while(j >= 2){ if(test != 1){ if(test * j * i * k == a){ b = (test*1000) + (k*100) + (i * 10) + (j); t = false; } }else if(k != 1 && test == 1){ if(j * i * k == a){ b = (k*100) + (i * 10) + (j); t = false; } }else if(k == 1 && test == 1){ if(j * i == a){ b = (i*10) + j; //std::cout <<"i == "<<(i)<< " + j == " << j << '\n'; t = false; } } j--; } i--; } k--; }test--; } if(a < 10){ if(a==0){ b = 10; t = false; }else if(a>=1){ b = a; t = false; } } if(t == false){ std::cout << b << '\n'; }else{ std::cout << -1 << '\n'; } return 0; } Edited by author 23.11.2010 23:07 In fact i don't really know C but i had the same problem on test 8 and the reason was that i needed bigger in (in pascal int64). Thanks. try test 244140625 its answer is 555555555555 I think the limit is 0<= N <= (10^9) not 109 Can anybody help me? I have the same WA :( Help anybody, please ! :D n=1. Good luck if (n == 1) { double ffffuuuu = in.nextDouble(); ffffuuuu = in.nextDouble(); out.println((double) (int) (2 * radius * PI * 100) / 100.0); out.flush(); return; } в чём ошибка!!! what is wrong!!! Edited by author 10.09.2012 19:38 try test: 1 2 0.0 0.0 length is 4*PI = 12.56637061.. so right answer is 12.57 error is found - the number of rounds my code do not have compile error, but it still can not work, I do not know where went wrong. import java.lang.*; import java.util.*; /** * * @author manyang */ public class Timus_1001 { //create a arraylist from input //donot konw how to play with arraylist, use a array public static void main(String[] args){ double num[] = new double[10000];//10000 is not precise, should determined by 256kb Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int i = 0; double result = Math.sqrt(sc.nextDouble()); num[i] = result; i++; } /*for arraylist, use arrayName.length output reversely calc each for array, use num[i] */ for (int i = num.length - 1; i >=0; i--) {
System.out.printf("%.4f", num[i]); System.out.println(); } }
}
My AC solution gives wrong answer on this test: 5 100 30 50 30 90 Right answer: 0 what is in the test #7? here is my program var n,k:longint; begin readln(n,k); if (n<=k) then write(2*n) else if (n mod k=0) then write(trunc(2*n/k)) else write(trunc(1+(n-(n mod k))/k+((n-abs(k-(n mod k)))-((n-abs(k-(n mod k))) mod k))/k+((n-abs(k-(n mod k))) mod k)/k)); end. my sotution is WA#7 too. help me,pls Does anybody know what the 13-th test is? Edited by author 07.04.2009 15:16 Also Wa15. What are wrong: 1. There are 17 choices 2. Greedy: we choice lexiographic best result at each step. unfortunately the problem is not of greedy type full search according all solutions of equation 10=k1+...+k17 helped to solve. Edited by author 21.10.2009 10:04 I agree with you, svr. Full search works fine. There are only 5311735 different configurations. I don't know why this error occurs, even the execution time is less then the time limit???? Please help me out?
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. Добрый день! Я сдал эту задачу, и у меня возникли трудности с условием. Во-первых, нигде не написано, что такое "внутри моря". Во-вторых, когда я догадался до значения вышеупомянутого термина, я не уловил смысла в следующем предложении: "Острова, касающиеся границы карты, не могут быть использованы для захоронений шаманов – шаманы этого очень не любят". Острова, находящиеся на границе, точно не лежат внутри никакого моря. В связи с этим, у меня возникло предположение, что ответ на следующий тест - 1 (что вроде неверно): 5 7 1 1 ..... .#### .#... .#.#. .#... .#### ..... (в ответ входит маленький островок справа). Поправьте условие, пожалуйста! "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'. |
|