HDU 1422(dp46)
来源:互联网 发布:nodejs nginx静态文件 编辑:程序博客网 时间:2024/05/20 23:19
#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>using namespace std;int dp[200005];int main(){ int n; while(scanf("%d",&n)!=EOF) { int i; int a,b; for(i=1;i<=n;i++) { scanf("%d%d",&a,&b); dp[i]=a-b; } int sum=0; int max=-1; int Count=0; for(i=1;i<2*n;i++) { sum+=dp[i%n+1]; if(sum>=0) { Count++; if(Count>max) max=Count; if(max==n) break; } else { sum=0; Count=0; } } printf("%d\n",max); } return 0;}
0 0
- HDU 1422(dp46)
- HDU 1171(dp46)
- HDU 2048 (dp46)
- HDU 1203(dp46)
- HDU 2159(dp46)
- HDU 2577(dp46)
- HDU 2870 (dp46)
- HDU 2191(dp46)
- HDU 1300(dp46)
- HDU 1501(dp46)
- HDU 3008(dp46)
- HDU 1224(dp46)
- HDU dp46
- HDU 1059(dp46,多重背包)
- hdu 2602 Bone Collector(dp46)
- HDU DP46题
- hdu dp46题
- hdu dp46题代码
- 【杭电oj1091】A+B for Input-Output Practice (III)
- 高通camera框架之如何打通App-Hardware经络
- 2016.8.11~14的三场模拟赛总结
- javaScript笔记(十九) 动态加载脚本和样式
- HDU 1074(dp46)(状态压缩dp)
- HDU 1422(dp46)
- 生命不息,战斗不止!
- STM8 外部中断
- Linux Makefile 详细语法
- 【杭电oj1092】A+B for Input-Output Practice (IV)
- 那些年,我们始终没有说出的痛
- 如何在Linux命令行中创建以及展示演示稿
- HDU 1300(dp46)
- Prim和kruskal