题意:

从A到B的汽车每隔 a 分钟发车一次,从A到B要ta分钟。

从B到A汽车每隔b分钟发车一次,从B到A要ta分钟。

Simion从A出发,问他在A->B的途中共遇到了多少辆车。

汽车都是从上午5.00出发,最晚到晚上11.59。

思路:

这种CF题模拟模拟!!!讲道理模拟题的能力好弱啊!!!

直接就是从5:00到11:59模拟一发,然后中间只会有两种可能,一个是那个人还没出去之前,一个是那个人出去了以后,车子在路上。

然后就是纯模拟就可以了,但是模拟的条件,还是靠感觉写的好啊

#include<iostream>
#include<cstdio>
#include<string.h>
#include<algorithm>
using namespace std; int main()
{ int a,ta;
int b,tb;
int hh,mm;
scanf("%d%d",&a,&ta);
scanf("%d%d",&b,&tb);
scanf("%d:%d",&hh,&mm);
int be=hh*60+mm;
int ed=hh*60+mm+ta;
int st=5*60;
int cnt=0;
while(st<60*24)
{
if((st<ed&&(st+tb)>be)||(st<ed&&st>be))
cnt++;
st+=b;
}
cout<<cnt<<endl;
return 0;
}

Educational Codeforces Round 12 A. Buses Between Cities的更多相关文章

  1. Educational Codeforces Round 12 A. Buses Between Cities 水题

    A. Buses Between Cities 题目连接: http://www.codeforces.com/contest/665/problem/A Description Buses run ...

  2. Educational Codeforces Round 12 F. Four Divisors 求小于x的素数个数(待解决)

    F. Four Divisors 题目连接: http://www.codeforces.com/contest/665/problem/F Description If an integer a i ...

  3. Educational Codeforces Round 12 E. Beautiful Subarrays 预处理+二叉树优化

    链接:http://codeforces.com/contest/665/problem/E 题意:求规模为1e6数组中,连续子串xor值大于等于k值的子串数: 思路:xor为和模2的性质,所以先预处 ...

  4. Educational Codeforces Round 12 E. Beautiful Subarrays 字典树

    E. Beautiful Subarrays 题目连接: http://www.codeforces.com/contest/665/problem/E Description One day, ZS ...

  5. Educational Codeforces Round 12 D. Simple Subset 最大团

    D. Simple Subset 题目连接: http://www.codeforces.com/contest/665/problem/D Description A tuple of positi ...

  6. Educational Codeforces Round 12 C. Simple Strings 贪心

    C. Simple Strings 题目连接: http://www.codeforces.com/contest/665/problem/C Description zscoder loves si ...

  7. Educational Codeforces Round 12 B. Shopping 暴力

    B. Shopping 题目连接: http://www.codeforces.com/contest/665/problem/B Description Ayush is a cashier at ...

  8. Educational Codeforces Round 12 E Beautiful Subarrays

    先转换成异或前缀和,变成询问两个数异或≥k的方案数. 分治然后Trie树即可. #include<cstdio> #include<algorithm> #define N 1 ...

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

    发生了好多事情 再加上昨晚教育场的爆零 ..真的烦 题目链接 A题经典题 这个题我一开始推公式wa 其实一看到数据范围 就算遍历也OK 存在的问题进制错误 .. 思路不清晰 两个线段有交叉 并不是端点 ...

随机推荐

  1. 生活娱乐 VERYCD的T恤设计大赛

    http://www.verycd.com/event/tee2011/ 购买网站: http://dianlv.taobao.com/

  2. 玩转Bash脚本:循环结构之while循环(转)

    转自:http://blog.csdn.net/guodongxiaren/article/details/43341769   总第8篇 本系列(玩转Bash脚本)更多文章,请访问:http://b ...

  3. eclipse 配置执行hadoop 2.7 程序样例參考步骤

    前提:你搭建好了hadoop 2.x的linux环境,并可以成功执行.还有就是window可以訪问到集群.over 1. hfds-site.xml 添加属性:关闭集群的权限校验.windows的用户 ...

  4. MySql视频教程——百度云下载路径

    百度云分享MySql视频教程给大家.祝大家事业进步! MySql视频教程:http://pan.baidu.com/s/1gdCHX79 password:n46i

  5. HDU 1085 Holding Bin-Laden Captive!(母函数,或者找规律)

    Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  6. 使用Poi对EXCLE的导入导出

    import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import ...

  7. navicat-premium11.1.6 x64关键

    Navicat Premium version patch   11.2.16.0 >navicat.exe0000000001CECCBC:80->C60000000001CECCBD: ...

  8. error at ::0 can&#39;t find referenced pointcut pointCutName 错误解决方法

    Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: publi ...

  9. Arrays.asList基本用法

    目录 说明 基本用法 陷阱 改观 说明 asList 是 java.util.Arrays 类的一个方法 public static <T> List<T> asList(T. ...

  10. 跨平台C++:(前言)正确打开C++的方式

    接触C++已经十五年了...但是对于C++而言,我至今是个门外汉,不是谦虚,而是确实不得其门而入. 历程是这样的—— 大学考研要考C++,就自学了.研没考上,C++算是学了,准确的说是C++的语法,以 ...