coderforce 588A Duff and Meat(简单的贪心)
来源:互联网 发布:mapinfo地图数据下载 编辑:程序博客网 时间:2024/06/08 07:27
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define LL long longconst LL maxm=1e5+10;LL a[maxm],p[maxm];int main(){ LL n; while(scanf("%lld",&n)!=EOF) { for(LL i=0;i<n;i++) { scanf("%lld%lld",&a[i],&p[i]); } LL sum=0; for(LL i=0;i<n;) { LL cnt=0; LL s=0; for(LL j=i+1;j<n;j++) { if(p[i]<p[j]) { cnt++; s+=a[j]; } else { break; } } sum+=(a[i]+s)*p[i]; i+=(cnt+1); } printf("%lld\n",sum); } return 0;}
0 0
- coderforce 588A Duff and Meat(简单的贪心)
- CodeForces 588A Duff and Meat 贪心
- Code Forces 588 A. Duff and Meat(贪心)
- Duff and Meat(贪心)
- 588A. Duff and Meat
- Codeforces#326-A - Duff and Meat-贪心
- A. Duff and Meat
- A. Duff and Meat
- Codeforces 588 A. Duff and Meat
- CodeForces-588A Duff and Meat
- codeforces 588 A Duff and Meat
- Codeforces 588A Duff and Meat 【dp】
- CodeForces 588A. Duff and Meat
- Codeforces Round #326 (Div. 2) 588 A. Duff and Meat
- Codeforces Round #326 A. Duff and Meat
- Codeforces 558 A Duff and Meat
- Codeforces 588.A Duff and Meat
- 【Codeforces Round 326 (Div 2)A】【贪心】Duff and Meat 屯肉前溯花费最低
- 自适应网页
- 如何成为优秀的架构师
- Oracle中创建dblink的方法
- 图片转换成data afn上传图片 图片转string
- HDU1034 Candy Sharing Game(java)
- coderforce 588A Duff and Meat(简单的贪心)
- 根据indexPath拿到UITableView的cell
- *第七周*数据结构实践项目三【负数把整数赶出队列】
- 顶层const和底层const
- 评价下面的代码片断
- javascript 表单提交的几种方法
- 第七周项目1-建立顺序环形队列算法库
- C语言变长数组data[0]的用法
- mysql windows 系统服务