|
|
Общий форумI understand the problem. There is one frying pan! Edited by author 29.08.2015 13:17 Edited by author 29.08.2015 14:14 Edited by author 29.08.2015 14:15 Can someone please tell me the problem with this code. It looks okay to me. Environment: Linux, G++ C++11, GCC version 4.9.2 #include <cmath> #include <iostream> #include <iomanip> #include <vector> #include <sstream> #include <ios> #include <string> using namespace std; int main(void) { vector<long long> v; string strBuf; long long result; while (getline(cin, strBuf)) { result = atoll(strBuf.c_str()); v.push_back(result); } vector<long long>::reverse_iterator ritr = v.rbegin(); while (ritr != v.rend()) { cout << fixed << setprecision(4) << sqrtl(*ritr) << endl; ++ritr; } return 0; } Compilation: $ g++ ktm_0_1.cpp -std=c++11 Sample execution seems fine to me: $ ./a.out 1427 0 876652098643267843 5276538 <-- After this, I enter CTRL-D manually 2297.0716 936297014.1164 0.0000 37.7757 try this one 7 1 1 2 2 4 3 5 3 7 2 9 0 5 7 answer is ccw have no idea what this test may be this test can help you: 9 4 1 2 4 3 4 6 4 5 4 7 5 8 5 9 7 BLOOD 5 answer is: 2 3 6 Good luck! My answer to this test is right,but i also get wa! why? Edited by author 18.10.2012 18:48 My answer is right but WA 5 ... I got runtime error at test 5. My algo works O(N^3) at 0.015 sec. Solution always exist. Idea: We must paint first half of edge in 'Y' and second half in 'G'. 1)Delete cycles (if the edge belongs to the cycle then we delete it from the graph) and paint edges; 2)Paint a tree. Edited by author 27.08.2015 15:36 I use bfs...but record the route in a map, and maybe the copy of the map cost too much time... How can I get all the routes in another good way? 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 |
|
|