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)\) ...
随机推荐
- Green Space【绿色空间】
Green Space Living in an urban area with green spaces has a long-lasting positive impact on people's ...
- layer父页面调用子页面的方法
由于不知道如何在子页面获取到layer定义的确定按钮,于是就在子页面上定义了一个方法,然后在由父页面在点确定按钮时调用子页面所定义的这个方法,从而执行子页面方法里面的内容: 子页面代码: functi ...
- RDLC Reporting in Visual Studio 2017
原文:RDLC Reporting in Visual Studio 2017 Visual Studio 2017 中可以使用 RDLC Reporting 插件来设计报表,SAP Crystal ...
- 1 django
1.MVC 大部分开发语言中都有MVC框架 MVC框架的核心思想是:解耦 降低各功能模块之间的耦合性,方便变更,更容易重构代码,最大程度上实现代码的重用 m表示model,主要用于对数据库层的封装 v ...
- MySQL之索引(二)
高性能的索引策略 正确地创建和使用索引是实现高性能查询的基础.在MySQL之索引(一)这一章中我们介绍了各种类型的索引及其对应的优缺点.现在我们一起来看看如何真正地发挥这些索引的优势. 独立的列 我们 ...
- 基类View
尽管类视图看上去类的种类繁多,但每个类都是各司其职的,且从类的命名就可以很容易地看出这个类的功能.大致可分为如下三个大的功能块,分别由三个类提供对应的方法: 处理 HTTP 请求.根据 HTTP 请求 ...
- Git的安装及常用操作
一.Git的安装 1.下载Git,官网地址为:https://git-scm.com/downloads. 2.下载完成之后,双击目录进行安装 3.选择安装目录 4.选择组件,默认即可 5.设 ...
- Azure继续降价云 价格战就此终结?
[TechTarget中国原创] 刚刚跨入2016年,就听到了云降价这样一个消息,但是我们却不要期望降价之风如去年一样呼呼不绝. 微软公司在本周宣称,他们将在下个月对其D系列虚拟机实施高达17%的降价 ...
- 【LoadRunner】利用lr_db_connect函数对Oracle数据库压测的完整流程
项目中常常会有直接对数据库进行压测的需求,以前都是通过Jmeter实现的,但是Jmeter本身图表及结果收集方面没有Loadrunner那么强大,所以利用loadrunner工具自己的函数整理了一个脚 ...
- LeetCode with Python -> Linked List
21. Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list s ...