Educational Codeforces Round 12 A. Buses Between Cities
题意:
从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的更多相关文章
- Educational Codeforces Round 12 A. Buses Between Cities 水题
A. Buses Between Cities 题目连接: http://www.codeforces.com/contest/665/problem/A Description Buses run ...
- 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 ...
- Educational Codeforces Round 12 E. Beautiful Subarrays 预处理+二叉树优化
链接:http://codeforces.com/contest/665/problem/E 题意:求规模为1e6数组中,连续子串xor值大于等于k值的子串数: 思路:xor为和模2的性质,所以先预处 ...
- Educational Codeforces Round 12 E. Beautiful Subarrays 字典树
E. Beautiful Subarrays 题目连接: http://www.codeforces.com/contest/665/problem/E Description One day, ZS ...
- Educational Codeforces Round 12 D. Simple Subset 最大团
D. Simple Subset 题目连接: http://www.codeforces.com/contest/665/problem/D Description A tuple of positi ...
- Educational Codeforces Round 12 C. Simple Strings 贪心
C. Simple Strings 题目连接: http://www.codeforces.com/contest/665/problem/C Description zscoder loves si ...
- Educational Codeforces Round 12 B. Shopping 暴力
B. Shopping 题目连接: http://www.codeforces.com/contest/665/problem/B Description Ayush is a cashier at ...
- Educational Codeforces Round 12 E Beautiful Subarrays
先转换成异或前缀和,变成询问两个数异或≥k的方案数. 分治然后Trie树即可. #include<cstdio> #include<algorithm> #define N 1 ...
- Educational Codeforces Round 12补题 经典题 再次爆零
发生了好多事情 再加上昨晚教育场的爆零 ..真的烦 题目链接 A题经典题 这个题我一开始推公式wa 其实一看到数据范围 就算遍历也OK 存在的问题进制错误 .. 思路不清晰 两个线段有交叉 并不是端点 ...
随机推荐
- uva 11468 - Substring(AC自己主动机+概率)
题目链接:uva 11468 - Substring 题目大意:给出一些字符和各自字符相应的选择概率.随机选择L次后得到一个长度为L的字符串,要求该字符串不包括随意一个子串的概率. 解题思路:构造AC ...
- ubuntu 用shell脚本实现将当前文件夹下全部文件夹中的某一类文件复制到同一文件夹下
当前文件夹下有一些文件和文件夹,当中每一个文件夹里都有若干.txt文件. 如今要求在当前文件夹创建一个新文件夹all,且将那些文件夹全部.txt文件 都复制到文件夹all.在ubuntu12.04的s ...
- 梳理caffe代码common(八)
因为想梳理data_layer的过程.整理一半发现有几个很重要的头文件就是题目列出的这几个: 追本溯源,先从根基開始学起.这里面都是些什么鬼呢? common类 命名空间的使用:google.cv.c ...
- LeetCode(3)题解: Longest Palindromic Substring
https://leetcode.com/problems/longest-palindromic-substring/ 题目: Given a string S, find the longest ...
- centos笔记-安装特定版本的mysql
centos6的yum默认安装的mysql是5.1版, 如果要安装5.6.16 版,有三个办法 1.yum方式, 这个方式的好处是通过yum安装卸载都很方便,坏处是版本无法详细制定,比如官方版本yum ...
- Pattern: Microservice Architecture
Microservice Architecture pattern http://microservices.io/patterns/microservices.html Context You ar ...
- LeetCode之16----3Sums Closest
题目: Given an array S of n integers, find three integers in S such that the sum is closest to a given ...
- 基于MATLAB的滤波算法
目前比较经典的图像去噪算法主要有以下三种: 均值滤波:也称线性滤波,主要思想为邻域平均法,即用几个像素灰度 的平均值来代替每个像素的灰度.有效抑制加性噪声,但容易引起图像模糊, 可以对其进行改进, ...
- HDU2612 Find a way —— BFS
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2612 Find a way Time Limit: 3000/1000 MS (Java/Others ...
- AutoEventWireup
Page_PreInit & OnPreInit - whats the difference? https://forums.asp.net/t/1095903.aspx?Page_PreI ...