zoukankan      html  css  js  c++  java
  • [CF911C]Three Garlands

    题目大意:
      给你三个灯,分别以k1秒一次,k2秒一次和k3秒一次的频率闪烁着。
      你可以自定义三个灯开启的时间,问是否有一种方案,使得max(k1,k2,k3)秒之后,每秒钟都至少有一盏灯闪烁。

    思路:
      很显然,当三盏灯频率都大于4秒一次时,不存在答案,那么我们只需要大力讨论4秒以内的情况即可。

     1 #include<cstdio>
     2 #include<cctype>
     3 #include<algorithm>
     4 inline int getint() {
     5     register char ch;
     6     while(!isdigit(ch=getchar()));
     7     register int x=ch^'0';
     8     while(isdigit(ch=getchar())) x=(((x<<2)+x)<<1)+(ch^'0');
     9     return x;
    10 }
    11 int main() {
    12     int k1=getint(),k2=getint(),k3=getint();
    13     if(k1>k2) std::swap(k1,k2);
    14     if(k2>k3) std::swap(k2,k3);
    15     if(k1>k2) std::swap(k1,k2);
    16     if(k1==1||k2<=2||k1==3&&k2==3&&k3==3||k1==2&&k2==4&&k3==4) {
    17         puts("YES");
    18         return 0;
    19     }
    20     puts("NO");
    21     return 0;
    22 }
  • 相关阅读:
    python pickle模块
    python struct模块
    python threading模块
    python queue模块
    python3 requests模块 基本操作
    python json模块
    C语言回调函数
    工厂方法模式
    git fetch, git pull 以及 FETCH_HEAD
    git删除远程文件夹或文件的方法
  • 原文地址:https://www.cnblogs.com/skylee03/p/8175579.html
Copyright © 2011-2022 走看看