Common Board//pseudo code divider = first_input-1; dividend = second_input-1; result: divider + dividend - FindCrossesOnTheWay(dividend,divider) *FindCrossesOnTheWay if(divider < dividend) swap() for(i=1;i<=divider;i++) if((dividend * i) % divider == 0) crosses++ I've implemented this problem two different ways and I have WA9 on both of them. I'm possibly interpreting the problem wrong, but I've read the problem over and over again and I cannot come up with an alternative interpretation. Can someone please shine some light? Если у кого ещё такая проблема есть, то это,как вариант, связано с нечетным n (последний человек ни разу не дежурит) #include <iostream> #include <string> using namespace std; int main() {string s; int o=0; getline(cin, s); string b1 = "adgjmpsvy. "; string b2 = "behknqtwz,"; string b3 = "cfilorux!"; for (int k=0; k<s.size();k++) { if (b1.find(s[k]) != string::npos) o++; if (b2.find(s[k]) != string::npos) o+=2; if (b3.find(s[k]) != string::npos) o+=3; } cout<<o; return 0; } Which algorithm?? Help I need help also. As i see you have solved it. Could you please help me? Try this: 3 2 of sweets 5 of milk 1 of sausage 4 6 of milk 3 of milk 1 of milk 3 of sweets Correct answer is: 8 Good luck! i have used long long and scanf still wa who can help me?plz 0.0 Below test helped me to pass test 5 after WA verdict: 5 6 4 0 6 0 3 0 7 0 8 department 1 10 1 department 2 10 1 department 3 10 1 department 4 10 1 department 0 7 10 department 0 500000000 1000000000 As you can check manually, correct answer is: 1000000014 1000000017 1000000014 1000000018 1000000019 it really helps,thanks bro I have 2 questions. 1. As AI Cash asked, can each design have two or more points with the same location? 2. "the pre-jury wants to find the designs which only differ in rearrangement of points and their affine transformation that doesn't change the orientation" does it mean that two designs (P1, P2, P3, ..., Pm) and (Q1, Q2, Q3, ..., Qm) will be considered same if there is an affine transformation Qi=A*Pi+b for all i such that A is matrix 2x2 that detA>0 ? Thank you from Thailand. :) Edited by author 22.09.2019 20:01 Hello, today i'm gonna tell ya how to solve this easy task! We can notice: 1 has places 0,1,3,6,10 etc. 0*8+1 = 1; 1*8+1 = 9; 3*8+1 = 25; 6*8+1 = 49; 10*8+1 = 81; I gave you the advice! So, it's easy! Good luck! If i hepled you, you may subscribe to my VK, Facebook, Instagram, Odnoklassniks, Patreon, Twitter, Twitch, Steam, Battlenet, Goggle+ and Youtube channel, there you'll find more solutions for problems! "If there is a problem, we solve it!" (c). Every rights are reserved. what is wrong with test #27 ? try 1 10000 answer 25007071.3178118650 25007071.3178118655 for 1 10000. Accurate enough, but still wrong answer on test case #27. try 10000 1 may be In #27 system checks output format I changed my python solution print FLOATANS to print "%0.6f" % FLOATANS and get AC Edited by author 08.05.2013 14:10 I had wrong answer on test 27, but corrected it by using "long double" type There's my code [code deleted] Edited by moderator 23.10.2019 22:04 just a joke Edited by author 18.09.2019 20:08 My full search say that solution exist for n<=22292 There is solution for all n <= 10^5 though I still can not fast enough generate answer I've solved this problem using DP. Hint: The maximum sum of numbers for required sequence does not exceed 1568617. According to my calculations the largest such sequence can be 344001 for the constraints of the problem. answer for every n exists there is no possibility to output “impossible” class Program { public static void Mod(int N, int M, int Y) { int f = 0, t = -1; for (int i = 0; i < M; i++) { int X = i; long y = X; for (int j = 2; j < N + 1; j++) { y = y * X; y = y % M; } if (y == Y) { if (f > 0) Console.Write($" "); Console.Write($"{X}"); f++; } } if (f == 0) Console.Write($"{t}"); Console.WriteLine(); } } Edited by author 17.09.2019 02:10 I've got WA on 4th test. Can anyone tell me some tests to check my solution? You have to use BigInteger, you can't simply use Long Long bc the answer can go up to 2^(1600) Just for information. On September 19 this site will be under maintenance, so it will be unavailable for about 5 hours starting from 10:00 GMT+5. Sorry for inconvenience. Edited by author 16.09.2019 15:55 Note, the required algorithm is known as the Kadane's algorithm and runs in O(n). ive googled that the answer for all n except 1 is 1 + 1/sin(PI/n), can smb explane me why? Centers of circles form a regular polygon with side length 2. Now, consider the formula to find circumradius of a regular polygon and add 1 because you were connecting circle centres, but not their tangent points to the circle. i also have wa#6 Give some tests or hints to understand logic of calculating Edited by author 01.11.2009 14:30 Try test 31 10 2 This test helped me to receive AC... thx Is the answer "6.00000 8.00000"? What is Test #16? Please someone help! What is Test #16? Please someone help! Same here... got stuck in Test-16 . so why did you get the WA16? Well maybe someone gonna read this but i got WA #16 cause my logic was wrong. i thought that i need to check if i studied any of prerequisite BUT i must check if i studied ALL OF them. maybe my code would help idk #include <iostream> #include <vector> using namespace std; int N, M, a[(int)1e3 + 5], b, c; bool visited[(int)1e3 + 5], flag, ans = true; vector <vector <int> > adj((int)1e3 + 5); int main() { cin >> N >> M; while(M--) cin >> b >> c, adj[c].push_back(b); for(int i = 0; i < N;++i) { cin >> a[i]; flag = true; visited[a[i]] = true; if(adj[a[i]].empty()) continue; for(int j = 0; j < adj[a[i]].size();++j) if(!visited[adj[a[i]][j]]) flag = false; if(!flag) ans = false; } if(!ans) cout <<"NO"; else cout << "YES"; } I have the feeling that this problem can not be solved with less then 9*k+7 rows in the control table(my solution has exactly 9*k+7 rows) but I have not proven it. Has anybody a shorter solution? Edited by author 06.04.2008 23:24 It can be solved using O(log(n) + log(k)) rows. Do it like that: 1) put AA right before # to the left. This is 00 written base 26. 2) go right until you encounter -. Put + there and then go left until you hit #. Increase that number (it will become AB). Then go right again. 3) if you encounter # while walking right, go left and compute coordinate of last - mathematically using cells to the left as memory with base-26 2-digit arithmetics. For arbitrary k and n it will be more than 2 of course, that's why it's O(log(k)+log(n)), but not a constant. 4) like in case of 2 run right/left by putting - instead of + until result becomes zero (decrease it with every - set). 5) Find rightmost - and paint everything to the left with + 6) Find - and stop there Though, I heard in this forum that the checker is wrong as it stops when there are n-1 pluses, but not when invalid state/character pair is met. So, actually you will have to use O(n) states to calculate 'n' and then bring back this value to calculation area inside read/write head :) My solution for each k output 604 lines. How did you do this? My solution uses 1003 lines for each k, and I don't know how to optimize it :( I also came up with 604 lines solution. Just go to the right incrementing the state (200 instructions), then output "X # something_related_to_josephus # <" for X in range [2, 201]. You've spent 400 states. Now your state number should have the information how many steps left you should make outputting '+' -- you will need 199 instructions for this. After that you'll have to add 5 more instructions JOSEPHUS_POINT - LEFT_MODE - < LEFT_MODE - LEFT_MODE + < LEFT_MODE # RIGHT_MODE # > RIGHT_MODE + RIGHT_MODE + > RIGHT_MODE - FINISH - = |
|