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)\) ...
随机推荐
- spoj 104 Highways(Matrix-tree定理)
spoj 104 Highways 生成树计数,matrix-tree定理的应用. Matrix-tree定理: D为无向图G的度数矩阵(D[i][i]是i的度数,其他的为0),A为G的邻接矩阵(若u ...
- Service IntentService区别 (面试)
依然记得自己当初没有真正的工作经验的时候的日子,满北京跑,没有人要.妈的,现在就想问,还有谁!想想真解气.不提了. 曾经有个面试官问我service 和IntentService的区别.当时自己模模糊 ...
- Python 内置函数isinstance
isinstance 用来判断对象的类型 isinstance(对象,类型/类型集合) 如果属于 返回True 不属于返回 False >>> a = 1 >>> ...
- Windows Server 2012之活动目录域服务的卸载
Windows Server 2012之活动目录域服务的卸载 2012-07-11 06:27:35 标签:Windows Server 2012 活动目录域服务 卸载 原创作品,允许转载,转载时请务 ...
- 手机APP设计网
http://hao.xueui.cn/ http://www.25xt.com/
- Android 使用intent传递返回值:startActivityForResult()与onActivityResult()与setResult()参数分析,activity带参数的返回
在一个父Activity通过intent跳转至多个不同子Activity上去,当子模块的代码执行完毕后再次返回父页面,将子activity中得到的数据显示在主界面/完成的数据交给父Activity处理 ...
- apple键盘中的Tilde / back-tick key can't work
使用波浪键的时候会输出>或<. 解决办法:http://atodorov.org/blog/2015/04/30/fixing-tilde-and-function-keys-mappin ...
- Notadd 2.0 全新 Node.js 版本~ (开发中) [从 PHP 到 node 的踩坑记]
对于 Notadd 我们本来期望它实现更多... 尽管我们也尝试做了很多努力,但是由于 PHP 本身的局限,以及考虑到开发环境配置的复杂程度,最终使用了折中方案.接下来,我们谈谈整个技术选型历程,也供 ...
- k8s与CICD--借助scp插件实现非容器项目的部署
一直没有时间完成drone系列文章.drone-wechat插件实现了一半,由于企业微信token申请比较麻烦,所以也没有进展.今天抽出时间,研究了一下scp插件,主要目的是实现非容器项目的部署.其实 ...
- [转载]用等高线图(Contour maps)可视化多变量函数
https://blog.csdn.net/xlinsist/article/details/50920479 Overview 由于我们用手来画三维图像很困难,我们可以用等高线图来描述图像会更加简单 ...