Couple doubi

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1087    Accepted Submission(s): 762

Problem Description
DouBiXp 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 balls 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 balls in turn and DouBiNan first. After all the balls are token,
they compare the sum of values with the other ,and the person who get
larger sum will win the game. You should print “YES” if DouBiNan will
win the game. Otherwise you should print “NO”.
 
Input
Multiply Test Cases.
In the first line there are two Integers k and p(1<k,p<2^31).
 
Output
For each line, output an integer, as described above.
 
Sample Input
2 3
20 3
 
Sample Output
YES
NO
 
Author
FZU
 
Source
 
数论: 费马引理
官方解题报告:
代码:
#include<stdio.h>
void main(){
int k,p;
while(~scanf("%d%d",&k,&p))
k/=(p-),puts(k&)?"YES":"NO");
}

2014---多校训练一(A Couple doubi)的更多相关文章

  1. hdu 4911 Inversion(归并排序求逆序对数)2014多校训练第5场

    Inversion                                                                             Time Limit: 20 ...

  2. hdu 4970 Killing Monsters(数组的巧妙运用) 2014多校训练第9场

    pid=4970">Killing Monsters                                                                   ...

  3. 2014暑假ACM训练总结

    2014暑假ACM训练总结报告 匆匆之中,一个暑假又过去了,在学校训练的这段日子真的是感觉日子过得好快啊! 时光如箭,日月如梭! 匆忙的学习之中一个暑假就这样结束了,现在就来写一些总结吧,供自己以后阅 ...

  4. HDU6578 2019HDU多校训练赛第一场 1001 (dp)

    HDU6578 2019HDU多校训练赛第一场 1001 (dp) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6578 题意: 你有n个空需要去填,有 ...

  5. HDU6579 2019HDU多校训练赛第一场1002 (线性基)

    HDU6579 2019HDU多校训练赛第一场1002 (线性基) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6579 题意: 两种操作 1.在序列末 ...

  6. HDU6621 K-th Closest Distance HDU2019多校训练第四场 1008(主席树+二分)

    HDU6621 K-th Closest Distance HDU2019多校训练第四场 1008(主席树+二分) 传送门:http://acm.hdu.edu.cn/showproblem.php? ...

  7. HDU 4869 Turn the pokers (2014多校联合训练第一场1009) 解题报告(维护区间 + 组合数)

    Turn the pokers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  8. HDU 4902 Nice boat 2014杭电多校训练赛第四场F题(线段树区间更新)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4902 解题报告:输入一个序列,然后有q次操作,操作有两种,第一种是把区间 (l,r) 变成x,第二种是 ...

  9. 2014多校第一场A题 || HDU 4861 Couple doubi

    题目链接 题意 : 有K个球,给你一个数P,可以求出K个值,(i=1,2,...,k) : 1^i+2^i+...+(p-1)^i (mod p).然后女朋友先取,再xp取,都希望赢,如果女朋友能赢输 ...

随机推荐

  1. Cheatsheet: 2014 11.01 ~ 11.30

    Mobile Android SDK: Working with Picasso View Debugging in Xcode 6 5 Common C# tasks in Apple Swift ...

  2. jquery 之height(),innerHeight(),outerHeight()方法区别详解

    在jQuery中,获取元素高度的函数有3个,它们分别是height(). innerHeight().outerHeight(). 与此相对应的是,获取元素宽度的函数也有3个,它们分别是width() ...

  3. DbUtils使用时抛出Cannot get a connection

    java.sql.SQLException: Cannot get a connection, pool error Timeout waiting for idle object Caused by ...

  4. python_way day13 paramiko

    paramiko 一.安装 pip3 install paramiko 二.使用 1.SSHClient 用于连接远程服务器并执行基本命令 import paramiko # 创建SSH对象 ssh ...

  5. git学习笔记08-分支管理策略-实际上我们应该怎么应用分支

    Git用Fast forward模式(快进模式),但这种模式下,删除分支后,会丢掉分支信息. 如果要强制禁用Fast forward模式,Git就会在merge时生成一个新的commit,这样,从分支 ...

  6. iOS - OC Copy 拷贝

    前言 copy:需要先实现 NSCopying 协议,创建的是不可变副本. mutableCopy:需要实现 NSMutableCopying 协议,创建的是可变副本. 浅拷贝:指针拷贝,源对象和副本 ...

  7. [转]ubuntu环境变量配置文件

    参考网址:http://www.bkjia.com/Linuxjc/1008127.html Ubuntu通常使用的几个配置文件主要有下面这几个: /etc/environment./etc/prof ...

  8. HDU5807分段dp

    DAG图. [题意] n(50)个城市m(c(n,2))条单向边(x,y),保证x<y 对于三个点(x,y,z)如果abs(w[x]-w[y])<=K && abs(w[x ...

  9. python把元组组合成字典

    list=((","16g"), (","32g"), (","red"), (","bl ...

  10. JavaWeb学习总结(七)—HttpServletRequest

    一.Request概述 request是Servlet.service()方法的一个参数,类型为javax.servlet.http.HttpServletRequest.在客户端发出每个请求时,服务 ...