Codeforces 851 A Arpa and a research in Mexican wave
来源:互联网 发布:用js做一个登录界面 编辑:程序博客网 时间:2024/05/18 03:35
题目地址
题意:你有n个人的一排,你要做出一个长为k的人浪,问第k秒的时候有多少个人站着。
思路:该题目就只会出现3种情况:
- 1、t<=k的时候,当前的人数为t
- 2、当t>n的时候,当前的人数为k-(t-n)
- 3、否则,当前的人数为n
判断这3种情况就好了。
#include <iostream>#include <cstring>#include <string>#include <queue>#include <vector>#include <map>#include <set>#include <stack>#include <cmath>#include <cstdio>#include <algorithm>#include <iomanip>#define N 1000010#define M 4000010#define LL __int64#define inf 0x7f7f7f7f#define lson l,mid,ans<<1#define rson mid+1,r,ans<<1|1#define getMid (l+r)>>1#define movel ans<<1#define mover ans<<1|1using namespace std;int main() { cin.sync_with_stdio(false); LL n, k, t; while (cin >> n >> k >> t) { if (t <= k) cout << t << endl; else if (t > n) cout << k - t + n << endl; else cout << k << endl; } return 0;}
阅读全文
0 0
- Codeforces 851 A Arpa and a research in Mexican wave
- Codeforces 851A Arpa and a research in Mexican wave
- CF 851A Arpa and a research in Mexican wave
- Codeforces 851A . Arpa and a research in Mexican wave 水题
- A. Arpa and a research in Mexican wave
- A. Arpa and a research in Mexican wave
- ACM刷题之codeforce————Arpa and a research in Mexican wave
- Codeforces 851A && Round #432 Div. 2 A. Arpa and a research in Mexic
- Codeforces 851E-Arpa and a game with Mojtaba
- Codeforces 851D. Arpa and a list of numbers
- codeforces 850B Arpa and a list of numbers
- Codeforces Round #432 B. Arpa and a list of numbers
- codeforces 851 D. Arpa and a list of numbers(前缀和+bruteforce)
- Codeforces 851D Arpa and a list of numbers【思维+前缀和】
- Codeforces 851 D. Arpa and a list of numbers(技巧)
- Codeforces 851D Arpa and a list of numbers Round #432 (Div. 2
- Codeforces 851 D Arpa and a list of numbers(前缀和)
- Codeforces 851D Arpa and a list of numbers (枚举+分段)
- 腾讯bugly热修复集成工程
- 关于编程的类型大小
- IntelliJ Idea gradle项目导出依赖包
- UNIX环境编程学习笔记(28)——多线程编程(三):线程的取消
- 从一个文件读取内容计算出结果,将结果写入到另一个文件中
- Codeforces 851 A Arpa and a research in Mexican wave
- 欢迎使用CSDN-markdown编辑器
- Python中的语句
- 编程语言的原子性与可见性
- Spring MVC 解读——<mvc:annotation-driven/>
- *leetcode 30 findSubstring
- 邝斌的ACM模板(伸展树(splay tree))
- MATLAB中读取网络照片
- PAT 1043. Is It a Binary Search Tree