Educational Codeforces Round 12补题 经典题 再次爆零

 发生了好多事情 再加上昨晚教育场的爆零 。。真的烦

题目链接

A题经典题 这个题我一开始推公式wa 其实一看到数据范围 就算遍历也OK

存在的问题进制错误 。。 思路不清晰 两个线段有交叉 并不是端点落在另一个线段

包含的情况落在线段外

a车不影响 结果直接给忽略

 1 #include <iostream>
 2 #include<cstdio>
 3 using namespace std;
 4 int main()
 5 {
 6    int a,ta,b,tb,hh,mm;
 7    cin>>a>>ta>>b>>tb;
 8    scanf("%d:%d",&hh,&mm);
 9    int tem=(hh-5)*60+mm;
10    int ans=0;
11    int l=tem,r=tem+ta;int n=((23-5)*60+59);
12    for(int i=0;i<=n;i+=b)
13    {
14       if((tb+i)<=l||i>=r) continue; 
15       ans++;
16    }
17    cout<<ans<<endl;
18    return 0;
19 }
AC代码
原文地址:https://www.cnblogs.com/Geek-xiyang/p/5417289.html