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 }
  • 相关阅读:
    manjaro开机出现grub 解决办法
    goquery 解析不了noscript
    同步服务器时间
    phpStorm中使用xdebug工具调试docker容器中的程序
    Goutte 获取http response
    在微信浏览器里使用js或jquery实现页面重新刷新
    Node Sass does not yet support your current environment
    微信支付服务商模式
    PHP获取月末时间
    JavaScript DOM 对象
  • 原文地址:https://www.cnblogs.com/ZERO-/p/9695542.html
Copyright © 2011-2022 走看看