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 ...
随机推荐
- window配置nginx+php+mysql
博客来源: http://www.cnblogs.com/wuzhenbo/p/3493518.html 启用nginx D:\nginx>nginx.exe 重启 D:\nginx> ...
- linux 安装samba
1. yum -y install samba 2. 配置 vi /etc/samba/smb.conf [global] 下面的 修改 workgroup = MYGROUPsecurity = s ...
- http强制跳转到https
原文地址:http://m.blog.csdn.net/article/details?id=8549290 需求简介 基于nginx搭建了一个https访问的虚拟主机,监听的域名是test.com, ...
- 【CodeVS 5032】【省队集训2016 Day5 T1】Play with array
一开始我用分块大法,分成$\sqrt{n}$块,每个块上维护一个Splay,然后balabala维护一下,时间复杂度是$O(n\sqrt{n}logn)$.后来对拍的时候发现比$O(n^2)$的暴力跑 ...
- 81B
模拟 字符串必须先清零,要不会出现玄学的问题 #include<iostream> #include<cstdio> using namespace std; string s ...
- Maven-搭建maven web项目
点击Eclipse菜单File->New->Other->Maven->Maven Project 在选择maven-archetype的界面进行如下操作:(其他选项基本与创建 ...
- APP的缓存文件到底应该存在哪?看完这篇文章你应该就自己清楚了
APP的缓存文件到底应该存在哪?看完这篇文章你应该就自己清楚了 彻底理解android中的内部存储与外部存储 存储在内部还是外部 所有的Android设备均有两个文件存储区域:"intern ...
- Linux的vim三种模式及命令
一般模式:在Linux终端中输入"vim 文件名"就进入了一般模式,但不能输入文字.编辑模式:在一般模式下按i就会进入编辑模式,此时就可以写程式,按Esc可回到一般模式. 命令模式 ...
- 【HDU 5818多校】Joint Stacks
用两个栈模拟,并保存每个点的时间戳.每次合并的时候记录合并时的时间戳mcnt和此时的topa和topb记做ta.tb. 每次pop的时候,如果栈的top的时间戳大于mcnt,则普通地pop,否则就在两 ...
- 【HDU 2874】Connections between cities(LCA)
dfs找出所有节点所在树及到树根的距离及深度及父亲. i和j在一棵树上,则最短路为dis[i]+dis[j]-dis[LCA(i,j)]*2. #include <cstring> #in ...