zoukankan      html  css  js  c++  java
  • Codeforces Gym101063 F.Bandejao (2016 USP-ICMC)

    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 ≤ NK ≤ 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

    Input
    1 2
    Output
    yes
    Input
    1 3
    Output
    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
    ");
    21         else printf("no
    ");
    22     }
    23     return 0;
    24 }
  • 相关阅读:
    spring helloworld
    Log4cpp介绍及使用
    带有机器人框架的.NET自己主动化測试
    typedef和define具体的具体差别
    史上最简单的Hibernate入门简单介绍
    Linux安装程序Anaconda分析
    TinyXml高速入门(一)
    js获取并设置&lt;p&gt;&lt;/p&gt;的显示的值。
    Tomcat 配置WEB虚拟映射 及 配置虚拟主机
    Gitserver几家互联网代理安装方法未能解决。
  • 原文地址:https://www.cnblogs.com/ZERO-/p/9695542.html
Copyright © 2011-2022 走看看