codeforces586C Gennady the Dentist(模拟)
来源:互联网 发布:淘宝开婴童家纺 编辑:程序博客网 时间:2024/06/07 03:48
题目链接:
http://codeforces.com/contest/586/problem/C
题目有些略复杂。。建议看不懂的同学去google翻译一下。。
AC代码:
#include<stdio.h>typedef long long ll;ll v[100100],p[100100],d[100100];ll ans[100100],an;bool vis[100100];main(){ ll n,an=0; scanf("%I64d",&n); for(int i=1;i<=n;i++){ scanf("%I64d%I64d%I64d",&v[i],&d[i],&p[i]); } for(int i=1;i<=n;i++){ if(!vis[i]){ ans[++an]=i; ll ak1=v[i]; ll ak2=0; for(int j=i+1;j<=n;j++){ if(!vis[j]){ p[j]-=ak1+ak2; if(p[j]<0){ vis[j]=1; ak2+=d[j]; } if(ak1)ak1--; } } } } printf("%I64d\n",an); for(int i=1;i<an;i++){ printf("%I64d ",ans[i]); } printf("%I64d\n",ans[an]); for(int i=2;i<=n;i++) printf("%d ",p[i]);}
0 0
- codeforces586C Gennady the Dentist(模拟)
- Code Forces 585 A. Gennady the Dentist(模拟)
- Codeforces 586C Gennady the Dentist 模拟
- codeforces 585A - Gennady the Dentist(模拟)
- Codeforces 586C Gennady the Dentist【模拟】
- Codeforces #325 Div2 C Gennady the Dentist(模拟、细节)
- Codeforces 585A Gennady the Dentist(暴力)
- Codeforces #325 C. Gennady the Dentist
- Codeforces Round #325 C Gennady the Dentist
- CodeForces#325 C. Gennady the Dentist
- codeforces 585A Gennady the Dentist
- coderforce 585A. Gennady the Dentist
- 【16.23%】【codeforces 586C】Gennady the Dentist
- Codeforces Round #325 (Div. 2) C. Gennady the Dentist(水题)
- Codeforces Round #325 (Div.2) C.Gennady the Dentist
- codeforces 586 C. Gennady the Dentist【Codeforces Round #325 (Div. 2)】
- The Last Ant(模拟)
- Reorder the Books(模拟)
- 宏定义抽取单例
- request.getParameter和getAttribute
- ML基石_LinearModelsForClassfication
- leetcode292——Nim Game
- basics %*c
- codeforces586C Gennady the Dentist(模拟)
- Eclipse UML 插件: ObjectAid UML Explorer
- HDU 2102 A计划 (BFS)
- web测试方法总结
- POJ 1465 Multiple(BFS+同于定理+打印路径)
- Adaboost训练过程的详解
- 如何更好地使用word(1)
- Struts漏洞分析与研究
- 【黑马程序员】【Foundation框架】NSNumber、NSValue和NSData