Hangzhou-Hangzhou 2014 + school joint training first game 1001 couple doubi tease couples
I won't say much about this title.
Q: K balls are on the table. Each ball has a value. The value of the I-th ball is 1 ^ I + 2 ^ I +... + (p-1) ^ I (mod P ). P is a prime number. After that, P is better than a male. Finally, all balls have a higher total score. If you win, "yes" is output; otherwise, "no" is output ". (Both male and female adopt the most effective strategy ).
Of course, P is an important formula for odd prime numbers. This is the sum of formulas. Of course, it's easy to know. If you do not know, you can find the rule in the table.
Based on this important formula, we can easily write code.
# Include <iostream> # include <stdio. h> typedef long ll; int main (INT argc, const char * argv []) {ll K, P; while (~ Scanf ("% i64d % i64d", & K, & P) {If (K/P-1) % 2) puts ("yes "); else puts ("no");} return 0 ;}
------------------------------------------------------------------
Move forward