概述
F.Bandejao
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("yesn"); 21 else printf("non"); 22 } 23 return 0; 24 }
转载于:https://www.cnblogs.com/ZERO-/p/9695542.html
最后
以上就是漂亮黑米为你收集整理的Codeforces Gym101063 F.Bandejao (2016 USP-ICMC)的全部内容,希望文章能够帮你解决Codeforces Gym101063 F.Bandejao (2016 USP-ICMC)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复