Couple doubi
Time Limit: 2000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 607 accepted submission (s): 435
Problem descriptiondoubixp has a girlfriend named doubinan. one day they felt very boring and decided to play some games. the rule of this game is as following. there are K bils on the desk. every ball has a value and the value of ith (I = 1, 2 ,..., k) Ball is 1 ^ I + 2 ^ I +... + (p-1) ^ I (mod P ). number P is a prime number that is chosen by doubixp and his girlfriend. and then they take bils in turn and doubinan first. after all the bils are token, they compare the sum of values with the other, and the person who get larger sum will win the game. you shoshould print "yes" if doubinan will win the game. otherwise you shoshould print "no ".
Inputmultiply test cases.
In the first line there are two integers K and P (1 <K, P <2 ^ 31 ).
Outputfor each line, output an integer, as described above.
Sample Input
2 320 3
Sample output
YESNO
Authorfzu
Source2014 multi-university training contest 1
Question: The level is a little scum. During the game, you can view the regular expression.
#include <iostream>#include <cstdio>using namespace std;int main(){ int k,p; while(cin>>k>>p) { if(p) if(k/(p-1)%2==0) cout<<"NO"<<endl; else cout<<"YES"<<endl; } return 0;}