• Codeforces Round #438 (Div.1+Div.2) 总结


    本来兴致勃勃的想乘着这一次上紫,于是很早很早的到了机房

    但是好像并没有什么用,反而rating-=47

    Codeforces Round #438(Div.1+Div.2)

    今天就这样匆匆的总结一下,心情不好qaq

    首先是 A.Bark to Unlock

    启示:(1)不能直接把char数组进行比较!!!

    (2)读题要读清,不能漏读条件!!!

     1 #include<bits/stdc++.h>
     2 using namespace std;
     3 int bo[3][30],n;
     4 string s,t;
     5 int main(){
     6     cin>>s;
     7     scanf("%d",&n); cin>>t;
     8     bo[1][t[0]-'a']=1; bo[2][t[1]-'a']=1;
     9     if (bo[1][s[0]-'a']&&bo[2][s[1]-'a']||bo[2][s[0]-'a']&&bo[1][s[1]-'a']){
    10             printf("YES"); return 0;
    11         }
    12     for (int i=2;i<=n;++i){
    13         cin>>t;
    14         if (s==t){
    15             printf("YES"); return 0;
    16         }
    17         bo[1][t[0]-'a']=1; bo[2][t[1]-'a']=1;
    18         if (bo[2][s[0]-'a']&&bo[1][s[1]-'a']){
    19             printf("YES"); return 0;
    20         }
    21     }
    22     printf("NO");
    23 }
    View Code

    然后是 B. Race Against Time

    总之我的做法时先把时针,分针,秒针在秒意义下的位置,进行排序

    然后把t1和t2也转化成相同状态,最后判断t1和t2分别在哪个位置

    大概就是这样

     1 #include<bits/stdc++.h>
     2 using namespace std;
     3 int h,m,s,t1,t2,s1,s2,s3,a1,a2;
     4 int main(){
     5     cin>>h>>m>>s>>t1>>t2;
     6     s1=3600*(h%12)+60*m+s; s2=720*m+12*s; s3=720*s;
     7     a1=3600*(t1%12); a2=3600*(t2%12);
     8     if(s1>s2)swap(s1,s2); if(s2>s3)swap(s2,s3); if(s1>s2)swap(s1,s2);
     9     if(a1>a2)swap(a1,a2); bool bo=0;
    10     if(s1<=a1&&a2<=s2|| s2<=a1&&a2<=s3)bo=1;
    11     if(a2<=s1||a1>=s3)bo=1; if(a1<=s1&&a2>=s3)bo=1;
    12     if(bo) puts("YES"); else puts("NO");
    13 }
    View Code

    最后只希望今天的CF我的rating不会掉吧,上紫我的水平可能还不够吧

  • 相关阅读:
    Linux系统管理
    Linux命令—压缩及其他
    Linux命令—文件目录
    SQL基本函数
    35.app后端搜索入门
    Java-希尔排序
    Android 显示意图和隐式意图的差别
    做webapp 使用JS来检測游览器是什么类型,或android是什么版本
    用iframe在您的站点中增加findjar的功能
    HDU 4026 Unlock the Cell Phone( 状态压缩 )
  • 原文地址:https://www.cnblogs.com/logic-yzf/p/7631581.html
Copyright © 2020-2023  润新知