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 ...
随机推荐
- Linux chkconfig命令
chkconfig命令主要用来更新(启动或停止)和查询系统服务的运行级信息.谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接. 使用语法:chkconfig [--ad ...
- git diff命令
1. 比较两次提交的差异 2. 两个分支之间的比较 3. 暂存区和版本库的比较
- IntelliJ_编译一直报错“找不到符号”
执行maven compile时一直报错"找不到符号",类 XXX 各种clean.compile都不行 最后执行Rebuild Project一次后解决 执行rebuild ...
- 【BZOJ 4269】再见Xor
zky学长提供的线性基求法: for(int i=1;i<=n;i++) for(int j=64;j>=1;j--) { if(a[i]>>(j-1)&1) { if ...
- mxnet目录结构
普通目录 R-package, R语言API, 因为用的python, 所以对R暂时不感兴趣 amalgamation, 将整个mxnet库打包成一个文件, 以方便直接在客户端调用, 如Android ...
- java-commons-HttpClient超时设置setConnectionTimeout和setSoTimeout
问题 之前使用httpclient请求数据 源码方法: public static String doHttp(HttpMethod result, int timeout, String chars ...
- 77.Android之代码混淆
转载:http://www.jianshu.com/p/7436a1a32891 简介 作为Android开发者,如果你不想开源你的应用,那么在应用发布前,就需要对代码进行混淆处理,从而让我们代码即使 ...
- 61.Android适配的那些P事(转)
转载:http://www.jianshu.com/p/29ef8d3cca85 首先我们看看百度搜索引擎上常见的认识入手: 图1:屏幕分辨率和常见屏幕密度关系 我们知道屏幕密度直接关系到我们所谓的1 ...
- Leetcode #28. Implement strStr()
Brute Force算法,时间复杂度 O(mn) def strStr(haystack, needle): m = len(haystack) n = len(needle) if n == 0: ...
- jquery插件-表单验证插件-提示信息中文化与定制提示信息
接上一篇 2)messages 提示:修改默认的提示信息最简单的方法是引入message_zh.js文件即可! 如果需要在validate()方法内提示则可以使用本选项 类型:Object 说明:自定 ...