http://codeforces.com/problemset/problem/4/B
来源:互联网 发布:数车caxa自动编程 编辑:程序博客网 时间:2024/05/18 02:10
#include<iostream>#include<cstdio>using namespace std;int main(){ int ans[50]; int d,sumTime; int time[50][2]; int min,max; while(scanf("%d%d",&d,&sumTime)!=EOF) { min=0; max=0; for(int i=0;i<d;i++) { scanf("%d%d",&time[i][0],&time[i][1]); min+=time[i][0]; max+=time[i][1]; } if(min<=sumTime&&sumTime<=max) { printf("YES\n"); int dis=sumTime-min; for(int i=0;i<d;i++) { if(i!=0) printf(" "); if(dis<=time[i][1]-time[i][0]) { printf("%d",dis+time[i][0]); dis=0; } else { printf("%d",time[i][1]); dis=dis-(time[i][1]-time[i][0]); } } printf("\n"); } else printf("NO\n"); } return 0;}
- http://codeforces.com/problemset/problem/4/B
- http://codeforces.com/problemset/problem/266/B
- http://codeforces.com/problemset/problem/4/A
- http://codeforces.com/problemset/problem/4/C
- Т-prime http://codeforces.com/problemset/problem/230/B
- http://codeforces.com/problemset/problem/1/A
- http://codeforces.com/problemset/problem/228/A
- http://codeforces.com/problemset/problem/236/A
- http://codeforces.com/problemset/problem/712/C
- http://codeforces.com/problemset/problem/237/C Primes on Interval
- dfs搜索练习题 http://codeforces.com/problemset/problem/589/J
- http://codeforces.com/problemset/problem/714/C Sonya and Queries
- http://codeforces.com/problemset/problem/4/D Mysterious Present (簡單LIS)
- http://codeforces.com/problemset/problem/716/C Plus and Square Root
- http://codeforces.com/contest/7/problem/B
- http://codeforces.com/contest/1/problem/B
- Codeforces ProblemSet 19B
- 欧拉路的判定 http://hihocoder.com/problemset/problem/1176
- http://codeforces.com/problemset/problem/4/A
- 获取顶级域名修正版,parseHost() (更新日期2013-1-3)
- 复用类二种到达这一目标的方法
- Android Intent
- APPWeb+PHP5+SQLite3在S3C6410上移植之四
- http://codeforces.com/problemset/problem/4/B
- UML和RUP之间的那点事
- (acm协会课程笔记)归并算法
- 深入理解proc文件系统
- 原型继承
- HDU 1272 并查集
- Android APK反编译详解(附图)
- [其它软件] 【手机通过电脑上网】只需几分钟,让电脑变WIFI【图文】
- http://codeforces.com/problemset/problem/4/C