1193. Up the Stairs
来源:互联网 发布:国泰安经济金融数据库 编辑:程序博客网 时间:2024/06/05 13:21
#include <iostream>#include <algorithm>using namespace std;int main() {int cases;cin >> cases;for(int count = 0; count < cases; count++) {int persons, floors, boxLeft;cin >> persons >> floors >> boxLeft;int time[persons];for(int i = 0; i < persons; i++) {int tmp1, tmp2;cin >> tmp1 >> tmp2;if(tmp2) {time[i] = 3 * floors - tmp1;}else {time[i] = floors + tmp1;}}sort(time, time+persons);int totalTimeLeft;if(boxLeft % persons) { totalTimeLeft = boxLeft / persons * 2 * floors + time[boxLeft % persons - 1];}else {totalTimeLeft = (boxLeft / persons - 1) * 2 * floors + time[persons - 1];}cout << totalTimeLeft << endl;}return 0;}
0 0
- 1193. Up the Stairs
- 1193. Up the Stairs
- Sicily 1193. Up the Stairs
- Sicily 1193. Up the Stairs
- sicily 1193. Up the Stairs
- Sisily 1193. Up the Stairs --by rupeng
- Sisily 1193. Up the Stairs --by ChaoRu
- Sicily 1193 Up the Stairs
- Sicily 1193 Up the Stairs
- 算法学习【17】—— 1193. Up the Stairs
- Up Stairs
- sicily——Up Stairs
- Up the creek 进退两难
- Give up the marriage!
- setting up the centos7
- Picking up the old days
- the first day, Cheer up!
- Fixing up the build process
- 一些不常见JS技巧
- 实例详细说明linux下去除重复行命令uniq
- 深入了解View(三)
- UML中的四种关系总结
- 从贝叶斯方法谈到贝叶斯网络
- 1193. Up the Stairs
- vim常用命令
- python zookeeper 在 uwsgi中 watcher不生效
- 4个Linux服务器监控工具
- Hibernate中Criteria、DetachedCriteria
- HDU3001 Travelling
- 深入了解View(四)
- 让Linux终端中执行的程序在后台运行 从前台变到后台
- iOS测试