Codeforces Round #425 (Div. 2) A
来源:互联网 发布:mac恢复出厂系统版本 编辑:程序博客网 时间:2024/05/18 01:10
A - Sasha and Sticks【水题】
题意:
有n根棒,2个人轮流取,一次取k个,当不够k个的时候就停止。Sasha先取,问Sasha是否能比另一个人取的多,多则输出YES,否则NO。
思路:
令x = n / k
,那么x
即为取的次数,当x为偶数说明取的一样多,当x为奇数说明先手取的多。
代码:
#include <bits/stdc++.h>using namespace std;typedef long long LL;typedef pair<int,int>pii;const int INF = 0x3f3f3f3f;int main() { long long n, k; cin >> n >> k; bool f = true; long long x = n / k; if(x % 2 == 1) puts("YES"); else puts("NO");}
阅读全文
0 0
- Codeforces Round #425 (Div. 2) A
- Codeforces Round #425 (Div. 2)(A+B)
- Codeforces Round #425 (Div. 2) A
- Codeforces Round #425 (Div. 2)A. Sasha and Sticks
- Codeforces Round #425 (Div. 2) A.Sasha and Sticks
- Codeforces Round #425 (Div. 2) A. Sasha and Sticks
- Codeforces Round #425 (Div. 2) A. Sasha and Sticks
- Codeforces Round #131 (Div. 2) A B
- Codeforces Round #174 (Div. 2) Problem A
- Codeforces Round #173 (Div. 2) A.Bit++
- Codeforces Round #181 (Div. 2) A题
- Codeforces Round #184 (Div. 2) A题
- Codeforces Round #185 (Div. 2)--A,B
- Codeforces Round #172 (Div. 2) A题
- Codeforces Round #166 (Div. 2) A题
- Codeforces Round #132 (Div. 2) A题
- Codeforces Round #131 (Div. 2) A题
- Codeforces Round #133 (Div. 2) A题
- python函数参数
- qt开发环境
- Spring学习系列:错误记录(一):Spring注解错误记录
- APUE之线程创建与终止
- 埃及分数
- Codeforces Round #425 (Div. 2) A
- luogu1965 【2013提高】转圈游戏(快速幂)
- module.export exports的区别
- JDBC详解
- 利用时间戳获取想要的时间
- java使用poi读取xlsx格式的Excel总结
- 在MacOS上部署Nginx+flup+flask+mysql
- leetcode 289. Game of Life
- 学习uboot前奏之hardware-mmu[s3c2440]