IDIOPEN 2013 D Negative People in Da House
来源:互联网 发布:汉字域名有价值吗 编辑:程序博客网 时间:2024/06/06 09:03
题目地址
题目大意:给出n种进出(p1,p2)情况,一定是先进后出,求房间里最少有多少个人
解题思路:简单模拟,当此时房间里的人数(进的人数)<出的人数时,才需要计数
#include <iostream>#include <cstdio>#include <cmath>#include <algorithm>#include <cstring>#include <queue>#include <string>#include <map>#include <stack>#include <list>#include <set>using namespace std;int main(){ int t,n,x,y,cnt,in; scanf("%d",&t); while(t--) { scanf("%d",&n); in = cnt = 0; for(int i = 0; i < n; i++) { scanf("%d%d",&x,&y); in += x; if(in < y) { cnt += (y-in); in += (y-in); } in -= y; } printf("%d\n",cnt); } return 0;}
0 0
- IDIOPEN 2013 D Negative People in Da House
- BNU33650:Negative People in Da House
- uestc OJ 1849Negative People in Da House
- IDIOPEN 2013 Traveling Cellsperson
- IDIOPEN 2013 E Ruben Spawns
- 利用RGB-D数据进行人体检测 People detection in RGB-D data
- 基于RGB-D数据的人体检测(People detection in RGB-D data)
- Famous people in C++
- People in Computer Vision
- People in Computer Vision
- CSS 3D House
- IDIOPEN 2013 A Angry Grammar Nazi(字符串处理)
- Psychological Strategy in Handling people
- da
- da
- DA
- da
- da
- 大型分布式网站架构设计与实践
- oracle 索引概述
- java第一个窗口
- HTTP的GET和POST格式解析
- TNS-12560/00350 协议适配器错误
- IDIOPEN 2013 D Negative People in Da House
- oracle索引
- Win8系统文件损坏,无法自动修复的解决方法
- Objective-C 【NSFileManager 介绍-基本用法】
- Struts 2 – i18n or localization example
- Uitableview中didSelectRowAtIndexPath常用的获取cell信息的方法
- ACM the water problem详解[C语言][线段树]
- Docker
- hdoj-1513-Palindrome【LCS+滚动数组】