HDU 4861(多校)1001 Couple doubi
(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”.
In the first line there are two Integers k and p(1<k,p<2^31).
2 3
20 3
YES
NO
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std; long long k,p;
int main()
{
while(~scanf("%I64d%I64d",&k,&p))
{
int s=0;
if(p==2)
{
if(((k+1)/2%2))
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
continue;
}
s=k/(p-1);
if(s%2)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
事实上仅仅要这样。。。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std; long long k,p;
int main()
{
while(~scanf("%I64d%I64d",&k,&p))
{
int s=k/(p-1);
if(s%2)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
我小学没毕业,干只是那些高中生。。
HDU 4861(多校)1001 Couple doubi的更多相关文章
- HDU 4861 Couple doubi(找规律|费马定理)
Couple doubi Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit ...
- hdu 4861 Couple doubi(数论)
题目链接:hdu 4861 Couple doubi 题目大意:两个人进行游戏,桌上有k个球,第i个球的值为1i+2i+⋯+(p−1)i%p,两个人轮流取,假设DouBiNan的值大的话就输出YES, ...
- 2014多校第一场A题 || HDU 4861 Couple doubi
题目链接 题意 : 有K个球,给你一个数P,可以求出K个值,(i=1,2,...,k) : 1^i+2^i+...+(p-1)^i (mod p).然后女朋友先取,再xp取,都希望赢,如果女朋友能赢输 ...
- HDU 4861 Couple doubi (数论 or 打表找规律)
Couple doubi 题目链接: http://acm.hust.edu.cn/vjudge/contest/121334#problem/D Description DouBiXp has a ...
- hdu 4861 Couple doubi (找规律 )
题目链接 可以瞎搞一下,找找规律 题意:两个人进行游戏,桌上有k个球,第i个球的值为1i+2i+⋯+(p−1)i%p,两个人轮流取,如果DouBiNan的值大的话就输出YES,否则输出NO. 分析:解 ...
- hdu 4861
http://acm.hdu.edu.cn/showproblem.php?pid=4861 两个人进行游戏,桌上有k个球,第i个球的值为1^i+2^i+⋯+(p−1)^i%p,两个人轮流取,如果Do ...
- HDU - 5753 多校联萌3-2
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5753 Sample Input Sample Output 6.000000 52.833333 分析 ...
- HDU 5358 多校第6场 First One
First One Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Tota ...
- hdu 6045 多校签到题目
http://acm.hdu.edu.cn/showproblem.php?pid=6045 题解:遍历一遍,求出两个人答案中相同的个数,用wa表示.然后我从大的数入手,当wa的数都尽可能在两个人答案 ...
随机推荐
- JS-OO-数据属性,访问器属性
一.数据属性 Configurable:表示能否通过Delete删除属性从而重新定义属性,能否修改属性的特性,能否把属性修改为访问器属性.默认true. Enumerable:表示能否通过for-in ...
- gvim 窗口最大化启动
此文来源于vimer的程序世界 首先需要 gvimfullscreen.dll 文件 下载gvimfullscreen.dll 下载源码 之后只需要在vimrc中配置如下代码就可以按F11使Vim全 ...
- arm-linux-gcc: Command not found
老是提示arm-linux-gcc找不到,但是确实是装好了,其实是权限的问题,Ubuntu没有root权限,刚开始用碰到很多麻烦,查了好多资料,终于把arm-linux-gcc: Command no ...
- 利用IIdentify接口实现点选和矩形选择要素
duckweeds 原文利用IIdentify接口实现点选和矩形选择要素 Identify接口定义了获得要素图层单个要素的属性的捷径方法.它有一个Identify方法,返回一个IArray数组对象. ...
- Tidhy
JavaBean.hbm.xml(hibernate配置方面的): <?xml version="1.0" encoding="UTF-8"?> & ...
- UE4制作插件的插件神器pluginCreator
本文章由cartzhang编写,转载请注明出处. 所有权利保留. 文章链接:http://blog.csdn.net/cartzhang/article/details/45644007 作者:car ...
- [JS Compse] 4. A collection of Either examples compared to imperative code
For if..else: const showPage() { if(current_user) { return renderPage(current_user); } else { return ...
- Powerful Bash-style command line editing for cmd.exe
https://mridgers.github.io/clink/ Clink Powerful Bash-style command line editing for cmd.exe Downloa ...
- 【转】关于python中带下划线的变量和函数 的意义
http://www.blogjava.net/lincode/archive/2011/02/02/343859.html 总结: 变量: 1. 前带_的变量: 标明是一个私有变量, 只用于标明 ...
- 手机端自适应布局demo
原型如下: 要求如下:适应各种机型 源码如下: <!DOCTYPE html > <html> <head> <meta http-e ...