Codeforces Gym101063 F.Bandejao (2016 USP-ICMC)
It is lunch time on Mars! Everyone has got that big smile on their faces, all eager to see what the GEMA restaurant is serving for dessert. Everything is pretty much like Earth, but nobody knows why, GEMA decided to invent new types of utensils. Somehow, the food research group concluded that the usual fork, knife and spoon would not be so adequate on Mars.
There are K types of utensils and if you want to have some food, you must use all Kof them (one of each). You like to have lunch with your N friends, and when you are leaving, you want to distribute the utensils among you and all your friends equally (everyone having the same amount of utensils). In addition to that, you want each one of your friends (you included) to carry only one type of utensil (it speeds up the process of leaving the restaurant, and your friends get really mad when it takes more time than usual for them to get back to work).
Given N and K, answer if it is possible for you and your friends to leave the restaurant with everyone carrying the same number of utensils and each one carrying only one type of utensil.
Input
Two integers N and K (0 ≤ N, K ≤ 100 and K > 0). (You and your friends form a group of N + 1 people).
Output
Print "yes" (if it is possible) or "no" without quotes.
Example
1 2
yes
1 3
no
代码:
1 #include<iostream>
2 #include<cstdio>
3 #include<algorithm>
4 #include<cstring>
5 #include<cstdlib>
6 #include<string.h>
7 #include<set>
8 #include<vector>
9 #include<queue>
10 #include<stack>
11 #include<map>
12 #include<cmath>
13 using namespace std;
14 typedef long long ll;
15 const int N=1e5+10;
16 int main(){
17 int n,k;
18 while(~scanf("%d%d",&n,&k)){
19 n+=1;
20 if(n%k==0)printf("yes\n");
21 else printf("no\n");
22 }
23 return 0;
24 }
Codeforces Gym101063 F.Bandejao (2016 USP-ICMC)的更多相关文章
- Codeforces 959 F. Mahmoud and Ehab and yet another xor task
\(>Codeforces\space959 F. Mahmoud\ and\ Ehab\ and\ yet\ another\ xor\ task<\) 题目大意 : 给出一个长度为 \ ...
- Codeforces 835 F. Roads in the Kingdom
\(>Codeforces\space835 F. Roads in the Kingdom<\) 题目大意 : 给你一棵 \(n\) 个点构成的树基环树,你需要删掉一条环边,使其变成一颗 ...
- Codeforces 731 F. Video Cards(前缀和)
Codeforces 731 F. Video Cards 题目大意:给一组数,从中选一个数作lead,要求其他所有数减少为其倍数,再求和.问所求和的最大值. 思路:统计每个数字出现的个数,再做前缀和 ...
- Codeforces 8VC Venture Cup 2016 - Elimination Round F. Group Projects 差分DP*****
F. Group Projects There are n students in a class working on group projects. The students will div ...
- Codeforces Gym101063 J.The Keys (2016 USP-ICMC)
J.The Keys Out of all science labs constructed by the GEMA mission on Mars, the DSL - Dangerous Spec ...
- Codeforces Gym101063 C.Sleep Buddies (2016 USP-ICMC)
C.Sleep Buddies It is nighttime in the Earth Colony on Mars and everyone is getting ready to sleep. ...
- Codeforces 797 F Mice and Holes
http://codeforces.com/problemset/problem/797/F F. Mice and Holes time limit per test 1.5 ...
- Codeforces 622 F. The Sum of the k-th Powers
\(>Codeforces \space 622\ F. The\ Sum\ of\ the\ k-th\ Powers<\) 题目大意 : 给出 \(n, k\),求 \(\sum_{i ...
- Codeforces 379 F. New Year Tree
\(>Codeforces \space 379 F. New Year Tree<\) 题目大意 : 有一棵有 \(4\) 个节点个树,有连边 \((1,2) (1,3) (1,4)\) ...
随机推荐
- P1616 疯狂的采药【模板】
此题为NOIP2005普及组第三题的疯狂版. 此题为纪念LiYuxiang而生. 题目描述 LiYuxiang是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师.为此,他想拜附近最有威望的医师为师. ...
- Redis实现之RDB持久化(二)
RDB文件结构 在Redis实现之RDB持久化(一)这一章中,我们介绍了Redis服务器保存和载入RDB文件的方法,在这一节,我们将对RDB文件本身进行介绍,并详细说明文件各个部分的结构和意义.图1- ...
- “帮你APP”团队冲刺3
1.整个项目预期的任务量 (任务量 = 所有工作的预期时间)和 目前已经花的时间 (所有记录的 ‘已经花费的时间’),还剩余的时间(所有工作的 ‘剩余时间’) : 所有工作的预期时间:88h 目前已经 ...
- 洛谷P1540 机器翻译
题目链接:https://www.luogu.org/problemnew/show/P1540
- IOS开发---菜鸟学习之路--(九)-利用PullingRefreshTableView实现下拉刷新
本章主要讲解如何利用PullingRefreshTableView实现下拉(上拉)刷新的操作 PullingRefreshTableView 实现上下拉刷新的例子百度有很多,大家可以自己搜索下,先看下 ...
- leetcode 【 Plus One 】python 实现
题目: Given a non-negative number represented as an array of digits, plus one to the number. The digit ...
- Windows核心编程小结3
内存映射和堆栈 内存映射文件 内存映射文件可以用于3个不同的目的: 系统使用内存映射文件,以便加载和执行.exe和DLL文件.这可以大大节省页文件空间和应用程序启动运行所需的时间. 可以使用内存映射文 ...
- sql注入语句大全
sql注入语句大全--是否存在xp_cmdshell and 1=(select count(*) from master.dbo.sysobjects where xtype = 'x' and n ...
- day02_05.除数与被除数
第5题 除数与被除数 编程需要一定数学能力,在这看看你找到了几个有用条件, 又该如何来运用他们呢? 学习是互通的 题目:两个自然数相除,商3余10,被除数,除数,商,余数的和是163,求被除数,除数. ...
- [错误解决]paramiko.ssh_exception.SSHException: Error reading SSH protocol banner 设置
报错信息 上午的时候数据组的同事跟我说有几个程序报错,经过查看log发现找到报错信息: paramiko.ssh_exception.SSHException: Error reading SSH p ...