|
|
вернуться в форумtest for all 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 Re: test for all this program fails (WA) at test 8 Re: test for all 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 Re: test for all 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. Re: test for all try test 244140625 Re: test for all its answer is 555555555555 Re: test for all I think the limit is 0<= N <= (10^9) not 109 |
|
|