Codeforce Problem 427A. Police Recruits
题目链接: http://codeforces.com/problemset/problem/427/A
题目意思:
警察和小偷的故事:某城市要办大事儿,需要整治社会治安,但人手不够,需要雇佣零时工,应付突发情况,条件如下:
1、 一次雇佣的人不超过10个 (刚开始读成了总数不超过10个),超过10个就当10个人处理
2、一个零时工一生只能处理一个罪犯
3、如果没有零时工或者零时数少于犯罪的数量,则发生相应的犯罪数量。 如 p 个警察 t 个罪犯, 则发生 t - p 犯罪。
思路:将上面三个条件模拟出来即可:
/* ****
* @Codeforce Problem 427A. Police Recruits
* @ 2014.5.11
******/#include <stdio.h>
int main(){int i, t, n, C, P, ans;scanf("%d", &n);C = P = ans = 0;for(i = 0; i < n; ++i){scanf("%d", &t);if(t > 10){P += 10;}else if(t > 0){P += t;}else if(t < 0){if(P + t > 0)P += t;else{ans += -P - t;P = 0;}}}printf("%d\n", ans);return 0;
}
Codeforce Problem 427A. Police Recruits相关推荐
- Police Recruits
文章目录 一.Police Recruits 总结 一.Police Recruits 本题链接:Police Recruits 题目: A. Police Recruits time limit p ...
- 21th Police Recruits
a . 题目链接 Problem - 427A - Codeforces b. 我的题解 #include <iostream> using namespace std; int main ...
- codeforce 570 problem E 51Nod-1503-猪和回文
1503 猪和回文 一只猪走进了一个森林.很凑巧的是,这个森林的形状是长方形的,有n行,m列组成.我们把这个长方形的行从上到下标记为1到n,列从左到右标记为1到m.处于第r行第c列的格子用(r,c)表 ...
- codeforce gym 100548H The Problem to Make You Happy
题意: Alice和Bob在一个有向图上玩游戏,每个人各自操作一个棋子,如果两个棋子走到一个点上,判定Bob输:如果轮到任何一方走时,无法移动棋子,判定该方输 现在Bob先走,要求判断胜负 题解 模型 ...
- HDU Problem - 5935 Car(模拟)
题目链接 Problem Description Ruins is driving a car to participating in a programming contest. As on a v ...
- codeforce 1311 C. Perform the Combo 前缀和
You want to perform the combo on your opponent in one popular fighting game. The combo is the string ...
- CF--思维练习--CodeForces - 221C-H - Little Elephant and Problem (思维)
ACM思维题训练集合 The Little Elephant has got a problem - somebody has been touching his sorted by non-decr ...
- 【Lintcode】1367. Police Distance
题目地址: https://www.lintcode.com/problem/1367/ 给定一个m×nm\times nm×n的矩阵,只含1,0,−11,0,-11,0,−1,111表示警察,000 ...
- question,problem,issue,matter,区别和用法
question 指主观存在的"疑惑.疑问",所以是需要"回答( answer )的". problem 指客观存在的和遇到的疑难问题,有时指较严重的问题,所 ...
- Codeforce题解:Shurikens
题目链接:https://codeforces.com/contest/1413/problem/D 题干描述: Tenten runs a weapon shop for ninjas. Today ...
最新文章
- 【复盘】端端,棒棒哒!
- Windows Server 2003 R2實現域內共享打印機智能部署
- Muduo 网络编程示例之四:Twisted Finger
- .net连接mysql数据_.net连接MYSQL数据库 转载
- 关于MYSQL 的 AUTO-INC Locks
- 关闭和启动Oracle的几种方法总结
- 抖音回应火山小视频被判赔腾讯800万元:目前已提起上诉
- Delphi Open Tools Api实例研究(一)
- C#之整数与字符串互转
- 企业大数据规划建设方案(PPT)
- html5颜色选择按钮,H5的input color系统颜色选择器
- CSS display 属性详解
- 微信小程序-获取用户头像信息以及修改用户头像
- 针对文字图片使用pillow对图片进行操作并判断图片相似度
- Cadence PCB层的概念
- JS 定时器整点定时刷新
- SimpleDateFormat使用
- 互联网+时代,淘宝模式的衰退不可避免
- graalvm把java编译为c/c++能够使用的动态库(dll/so)
- SitePoint播客#152:芬兰对面
热门文章
- 8088单板机的端口地址与汇编驱动代码
- DDLS-200/120.2劳易测光电传感器的电气连接
- WPF基础四:UI的相关类 (3)ContentControl类
- 【递推】1197:山区建小学http://ybt.ssoier.cn:8088/problem_show.php?pid=1197
- css 去除文本框按钮发光圈,tips之CSS动态实现文本框清除按钮的隐藏与显示
- 应用PowerBuilder写数据库程序
- OA系统的“四化”演变过程
- 两张图按同一坐标合并_excel如何将两个图合并为同X轴,不同Y轴的图?
- Python爬虫案例Demo——拉勾招聘信息的爬取
- C语言习题:5位运动员参加了10米台跳水比赛,有人让他们预测比赛结果