您的位置:首页 > 其它

codeforces 665A Buses Between Cities

2016-06-30 17:40 176 查看
简单题

#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;

int a,ta,b,tb;
int hh,mm;

int f(int st,int en,int ss,int ee)
{
if(ee<=st) return 0;
if(en<=ss) return 0;
return 1;
}

int main()
{
scanf("%d%d",&a,&ta);
scanf("%d%d",&b,&tb);
scanf("%d:%d",&hh,&mm);

int st=hh*60+mm;
int en=hh*60+mm+ta;

int t=0;
int ans=0;

while(1)
{
int ss=5*60+t*b;
int ee=ss+tb;
if(ss>=24*60) break;
if(f(st,en,ss,ee)==1) ans++;
t++;
}

printf("%d\n",ans);
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: