Codeforces 697A. Pineapple Incident (模拟)
来源:互联网 发布:数据编程是什么工作了 编辑:程序博客网 时间:2024/06/01 10:24
题目链接
简单题意
狗会在t时刻叫一声,之后每过s时间,他会叫两声,即在t+k*s和t+k*s+1时刻叫,给出一个时刻x,问狗会不会在x时刻叫
思路
当(x-t)%s ==0 或==1时叫,第一次特判,其他时间都不叫。
代码
#include <bits/stdc++.h>using namespace std;int main (){ int t,s,x; cin >> t >> s >>x; if(x == t){puts("YES"); return 0;} if(x < s+t && x != t){puts("NO"); return 0;} x -= t; if(x < 0) {puts("NO");return 0;} x %= s; if(x ==0 || x == 1) puts("YES"); else puts("NO"); return 0;}
0 0
- Codeforces 697A. Pineapple Incident (模拟)
- CodeForces 697 A. Pineapple Incident(水~)
- Codeforces 697A - Pineapple Incident
- CodeForces 697A Pineapple Incident
- CodeForces 697A Pineapple Incident(数列,水下题)
- codeforces #362(div.2)A.Pineapple Incident【水题】
- Codeforces Round #362 (Div. 2) A. Pineapple Incident(水题)
- cdeforces 697 A. Pineapple Incident (数学)
- A. Pineapple Incident
- Codeforces Round #362 (Div. 2) A. Pineapple Incident
- 【Codeforces Round 362 (Div 2)A】【简单讨论】Pineapple Incident
- Codeforces Round #362 (Div. 2) A. Pineapple Incident
- Pineapple Incident
- Pineapple Incident,Barnicle,Lorenzo Von Matterhorn(cf#362)
- CodeForces 349A Cinema Line (模拟)
- codeforces-#465A. inc ARG(模拟)
- Codeforces 2A-Winner(模拟)
- codeforces-#475A. Bayan Bus(模拟)
- Effective C++:绝不重新定义继承而来的缺省参数值
- c语言之左右法则
- sqlite 数据库开发中一些用法
- 使用Maven 整合Spring和hibernate 适合初级接触的学者
- 设计模式之适配器模式
- Codeforces 697A. Pineapple Incident (模拟)
- 百度地图应用开发基本配置
- static inline内联函数
- android学习之展示图片资源
- oracle表分区详解
- tomcat系统架构简介
- [iOS开发]关于cocoapods的使用
- Netty 作为服务器端源代码剖析
- 关于js与android方法互调的问题