码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-10-06 15:26:31      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:put   pen   for   不能   round   技术分享   pac   lock   这一   

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

但是好像并没有什么用,反而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不会掉吧,上紫我的水平可能还不够吧

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

标签:put   pen   for   不能   round   技术分享   pac   lock   这一   

原文地址:http://www.cnblogs.com/logic-yzf/p/7631581.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!