|
|
Общий форум47 times i had submitted a code with a small bug in heap... I'm sad... компилятор visual studio 2010 - 1wa c++11 -4wa c++14 -4wa КАК???!!! код #include <iostream> #include <string> using namespace std; int main() { long int a; cin >> a; if(a < 7){ cout << a; return 0; } if(a>=7) cout << a%7; } I think number's type long more. You don't used long long. 3 ABC => 5 13 CCCCCBBBBBAAABC => 992 9 ABCCBACAB => 466 9 CCABBACCB => 292 10 ACCABBACCB => 585 1) a first number is always >0 except N=5 2) long types of numbers give AC can anyone help me Edited by author 13.10.2011 18:53 Edited by author 13.10.2011 18:53 Edited by author 13.10.2011 19:32 To people with WA9, maybe this helps: 4 2 1 3 1 Licensed 2 4 1 Licensed Answer: Offline 1)Рассмотреть по-честному ВСЕ случаи( их не более 8); 2)Лучше использовать массив размером 50001 элемент(у меня с 15001 не прошло); 3)Лучше использовать тип данных longint( >50000),т.к. с integer не прошло. According to input data 9!! = 9(9-1*2)(9-2*2)(9mod2) = 9*7*5*1=315 Edited by author 04.06.2015 18:13 Edited by author 04.06.2015 18:13 You forgot the multiplication with 3. 9 !! = 9(9-1*2)(9-2*2)(9-3*2)(9-4*2) = 9 * 7 * 5 * 3 * 1 = 945 The formula presented in the text has some "...", meaning that the product continues until the last member is either n mod k (in case n doesn't divide k) or k (in the other case). it will minus(-) what your input in string.... like you input (!!!) and enter 9,,,so there 9-3=6 then 6-3=3 then 3-3=1 so 9*6*3*1=162 so that's why u can solve this by 9 !!==> 9-2=7,7-2=5,5-2=3,3-2=1; so 9*7*5*3*1=945. that's it Hi, I have a solutions which work correct with all my example and I check answer with http://webspace.ship.edu/deensley/mathdl/Joseph.html but I got #WA2, can anyone help? this is sol for k = 2 2 42 1 - 402 - = 402 + 402 + > 402 - 403 - > 403 + 403 + > 403 - 404 - < 404 + 404 + < 404 - 101 - = 403 # 412 # < 412 + 412 + < 412 - 413 - < 413 - 422 - > 413 + 413 + < 422 + 422 + > 422 - 102 - > 413 # 432 # > 432 + 432 + > 432 - 502 - = 502 - 503 - = 402 # 452 # < 452 + 452 + < 452 - 453 - < 453 + 453 + < 453 - 950 - = 950 - 950 - < 950 + 950 + < 950 # 101 # > 453 # 462 # > 462 + 462 + > 462 - 502 - = 101 - 102 - > 101 + 101 + > 101 # 701 # < 701 - 701 - < 701 + 701 + < 701 # 101 # > 102 - 1102 + = 1102 + 402 + = 102 + 102 + > 102 # 702 # < 702 - 702 - < 702 + 702 + < 702 # 102 # > Maybe someone got AC and can help me? I can send my code, there 30 + 6*k rows Thanks anyway the 5th test is really big, you might want to check long longs where it is needed try this test 50 CCCCC...CCCC (50 times) answer is 1125899906842623 You can precalculate all the results in a char matrix (c++), occupies less than int. With the given memory contraints, you can doit like that. Before realize that, I had to solve it in the way it's described on the statment, but later of try several test cases, I figured out the real problem. Just sort it in descending way. Good luck. I can't believe this. Edited by author 25.08.2015 10:37 This problem text add If there are several solutions output any one. For example n=3 1 2 2 k=3 sum=7 divisors number 2, k=2 sum=3 divisors number 2, k=1 sum=1 divisors number 1 For those, who has WA4, try this test: Input: 1 0 1 1 10 20 Output: 0 the test is 1 1 the answer is obvious:) for input 3 3, I guess the result should be 3. Why it is 2? Because the matrix is formed by (n-1) x (m-1) squares, and nxm corners, understand? You need to calculare how much squares has you overflown. I use the algo with N Dijkstras. Does anyone know, can I get AC with that algo, or 0.5 sec is not enough for it? I use Dijkstra and the language Python. If you are using C/C++ you can be well within the 0.5 sec, when implemented properly. Slow judging, seems to be an issue TLE24 with 3 different codes <3 |
|
|