解题报告
两人轮流取球,大的人赢,,,
贴官方题解,,,反正我看不懂。,,先留着理解

找规律找到的,,,sad,,,
非常easy找到循环节为p-1,每个循环节中有一个非零的球。所以仅仅要推断有多少完整循环节。在推断奇偶,。,
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath> using namespace std; int main()
{
int k,p,i,j;
while(scanf("%d%d",&k,&p)!=EOF){
int q=k/(p-1);
if(q%2==0)
printf("NO\n");
else printf("YES\n");
}
return 0;
}

Couple doubi

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 145    Accepted Submission(s): 122

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
 
Source

2014 Multi-University Training Contest 1/HDU4861_Couple doubi(数论/法)的更多相关文章

  1. 2019 Multi-University Training Contest 1 - 1011 - Function - 数论

    http://acm.hdu.edu.cn/showproblem.php?pid=6588 新学到了一个求n以内与m的gcd的和的快速求法.也就是下面的S1. ①求: $ \sum\limits_{ ...

  2. HDU4888 Redraw Beautiful Drawings(2014 Multi-University Training Contest 3)

    Redraw Beautiful Drawings Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Jav ...

  3. hdu 4946 2014 Multi-University Training Contest 8

    Area of Mushroom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  4. 2014 Multi-University Training Contest 9#11

    2014 Multi-University Training Contest 9#11 Killing MonstersTime Limit: 2000/1000 MS (Java/Others)   ...

  5. 2014 Multi-University Training Contest 9#6

    2014 Multi-University Training Contest 9#6 Fast Matrix CalculationTime Limit: 2000/1000 MS (Java/Oth ...

  6. 2014 Multi-University Training Contest 1/HDU4864_Task(贪心)

    解题报告 题意,有n个机器.m个任务. 每一个机器至多能完毕一个任务.对于每一个机器,有一个最大执行时间Ti和等级Li,对于每一个任务,也有一个执行时间Tj和等级Lj.仅仅有当Ti>=Tj且Li ...

  7. hdu 4937 2014 Multi-University Training Contest 7 1003

    Lucky Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) T ...

  8. hdu 4941 2014 Multi-University Training Contest 7 1007

    Magical Forest Time Limit: 24000/12000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Other ...

  9. hdu 4939 2014 Multi-University Training Contest 7 1005

    Stupid Tower Defense Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/ ...

随机推荐

  1. JavaScript 内存

    JavaScript 中对内存的一些了解 在使用JavaScript进行开发的过程中,了解JavaScript内存机制有助于开发人员能够清晰的认识到自己写的代码在执行的过程中发生过什么,也能够提高项目 ...

  2. 解决alaert.builder二次调用报错的bug

    报错的代码是: The specified child already has a parent. You must call removeView() on the child's parent f ...

  3. 深入探索C++对象模型-语义

    有三种情况,这将是一个object的内容,以及一class object早期值: class X { ... }; X x; X xx = x;               // 情况1,赋值对象 e ...

  4. The app references non-public selectors in payload With Xcode6.1

    猴子原创,欢迎转载.转载请注明: 转载自Cocos2D开发网–Cocos2Dev.com,谢谢! 原文地址: p=591" style="color: rgb(255, 97, 0 ...

  5. 重新想象 Windows 8 Store Apps (17) - 控件基础: Measure, Arrange, GeneralTransform, VisualTree

    原文:重新想象 Windows 8 Store Apps (17) - 控件基础: Measure, Arrange, GeneralTransform, VisualTree [源码下载] 重新想象 ...

  6. 选择排序java

    先简述选择排序,然后上代码 进行选择排序就是将所有的元素扫描一遍,从中挑选(或者说是选择,这正是这个排序名字的由来)最小的一个元素,将这个最小的元素与最左边的元素交换位置 ,现在最左边的元素就是有序的 ...

  7. Razor button

    比起Web Form開發,在後端(.cs)寫法上大同小異,可選擇C#或VB.NET來撰寫:而在前端(.cshtml..vbhtml)則有比較大的差別,自 MVC3版本後,就以Razor為前端檢視引擎, ...

  8. JAVA IP地址转成长整型方法

    JAVA IP地址转成长整型方法 代码例如以下: /** * IP转成整型 * @param ip * @return */ public static Long ip2int(String ip) ...

  9. HDU 1698 Just a Hook (段树更新间隔)

    Problem Description In the game of DotA, Pudge's meat hook is actually the most horrible thing for m ...

  10. 浅谈web网站架构演变过程(转)

    前言 我们以javaweb为例,来搭建一个简单的电商系统,看看这个系统可以如何一步步演变.   该系统具备的功能:   用户模块:用户注册和管理 商品模块:商品展示和管理 交易模块:创建交易和管理 阶 ...