Codeforces 697A - Pineapple Incident
题目链接:http://codeforces.com/problemset/problem/697/A
题目大意:
输入三个数 t,s,x; 判断x是否合适
合适的位置位 t , t+s, t+s+1, t+2s , t+2s+1 ,t+3s, t+3s+1 ......
如果在合适的位置中,输出 “YES” 不合适输出“NO”
解题思路:
如果x<t 不合适
如果 (x-t)%s !=0|| !=1 合适 【注意要排除 x=t+1 这种情况】
AC Code :
#include<stdio.h>
int main()
{
int t,s,x,tem;
while(~scanf("%d%d%d",&t,&s,&x))
{
tem=(x-t)%s;
if(x<t||x==t+||(tem!=&&tem!=))puts("NO");
else puts("YES");
}
return ;
}
Codeforces 697A - Pineapple Incident的更多相关文章
- Codeforce 697A - Pineapple Incident
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks ...
- Codeforces Round #362 (Div. 2)->A. Pineapple Incident
A. Pineapple Incident time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces Round #362 (Div. 2) A.B.C
A. Pineapple Incident time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces Round #362
A - Pineapple Incident #pragma comment(linker, "/STACK:102c000000,102c000000") #include &l ...
- Codeforces Round #362 (Div. 2) A 水也挂
A. Pineapple Incident time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces Round #362 (Div. 2)
闲来无事一套CF啊,我觉得这几个题还是有套路的,但是很明显,这个题并不难 A. Pineapple Incident time limit per test 1 second memory limit ...
- Codeforces Round #342 (Div. 2) B. War of the Corporations 贪心
B. War of the Corporations 题目连接: http://www.codeforces.com/contest/625/problem/B Description A long ...
- Codeforces Round #192 (Div. 1) C. Graph Reconstruction 随机化
C. Graph Reconstruction Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/3 ...
- Codeforces Round #375 (Div. 2) F. st-Spanning Tree 生成树
F. st-Spanning Tree 题目连接: http://codeforces.com/contest/723/problem/F Description You are given an u ...
随机推荐
- 切割haproxy的日志
日志的切割有以下几种方法: 1.写个定时任务,每天某个时间点把旧的日志重命名,并对服务重启使其重新打开日志并写入. 2.通过管道的方式把新产生的日志写到另外一个日志文件里. 3.通过logrotate ...
- 提高你的数据库编程效率:Microsoft CLR Via Sql Server
你还在为数据库编程而抓狂吗?那些恶心的脚本拼接,低效的脚本调试的日子将会与我们越来越远啦.现在我们能用支持.NET的语言来开发数据库中的对象,如:存储过程,函数,触发器,集合函数已及复杂的类型.看到这 ...
- Easyui数据表格-地区列表及工具栏增删改
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- 【COGS 254】【POI 2001】交通网络图
http://www.cogs.top/cogs/problem/problem.php?pid=254 dist[i]表示能最早到达i点的时间.这样就可以用最短路模型来转移了. #include&l ...
- 【BZOJ 1030】【JSOI 2007】文本生成器 AC自动机+递推
一直不理解到底怎么做啊,想了好久$TwT$ 最后终于明白了为什么找到第一个满足条件的$fail$就计算,因为避免重复,这个回答,,, 然后$root$下面要接上26个节点,这里26个字母中不在字典内的 ...
- mysql优化基础
唯一索引(unique index)强调唯一,就是索引值必须唯一. create unique index [索引名] on 表名 (列名);alter table 表名 add unique ind ...
- 在浏览器中输入URL后执行的全部过程的个人总结
这个问题经常可以看到,今天我好好总结了下,是从网络模型的角度来分析问题的,主要涉及应用层:DNS,HTTP,传输层:TCP,网络层:IP和路由选择协议:RIP,OSPF(内部网关协议),BGP(外部网 ...
- 【Codeforces 723D】Lakes in Berland (dfs)
海洋包围的小岛,岛内的有湖,'.'代表水,'*'代表陆地,给出的n*m的地图里至少有k个湖,求填掉面积尽量少的水,使得湖的数量正好为k. dfs找出所有水联通块,判断一下是否是湖(海水区非湖).将湖按 ...
- bzoj2200: [Usaco2011 Jan]道路和航线
先忽略航线,求出图中所有连通块,再用航线拓扑排序求出每个连通块的优先级 然后dijkstra时优先处理优先级高的块里的点就行了 ps:这题SPFA会TLE #include <iostream& ...
- python time函数
时间间隔是以秒为单位的浮点小数. 每个时间戳都以自从1970年1月1日午夜(历元)经过了多长时间来表示. Python附带的受欢迎的time模块下有很多函数可以转换常见日期格式.如函数time.tim ...