poj2586 贪心算法
来源:互联网 发布:淘宝300多的充气娃娃 编辑:程序博客网 时间:2024/05/02 01:58
自己准备先简单的入门一下ACM 希望能有所进步
一道简单贪心算法 原题目:http://poj.org/problem?id=2586
#include<iostream>int main(){int d,s;int mon[12];int sum;while((scanf("%d%d",&s,&d))==2){sum=0;for(int i=0;i<12;i++)mon[i]=s;for(int i=0;i<8;i++){int start=i;for(int i=0;i<5;i++){if((mon[start]+mon[start+1]+mon[start+2]+mon[start+3]+mon[start+4])>=0){mon[start+4-i]=-d;}else break;}}for(int i=0;i<12;i++)sum=sum+mon[i];if(sum>=0)printf("%d\n",sum);else printf("Deficit\n");}}
0 0
- poj2586 贪心算法
- POJ2586--贪心
- poj2586 贪心
- POJ2586(贪心)
- poj2586贪心
- POJ2586(贪心)
- 贪心poj2586
- poj2586 典型贪心
- 【贪心】POJ2586 Y2K Accounting Bug
- poj2586 Y2K Accounting Bug 贪心
- poj2586 (盈亏计算贪心)
- POJ2586 Y2K Accounting Bug(贪心)
- POJ2586 Y2K Accounting Bug 贪心
- poj1323,poj2586贪心容易题
- poj2586 Y2K Accounting Bug 贪心
- poj2586 Y2K Accounting Bug 贪心
- POJ2586 Y2K Accounting Bug(贪心)
- poj2586 贪心水题一道(一步贪心)
- Wireshark学习笔记
- Java大数汇总
- Ananagrams-UVA 156
- 实例2:设置复选框-优化1
- [leetcode: Python]257. Binary Tree Paths
- poj2586 贪心算法
- Java 构造器
- JS Date对象
- HDU 1019 Least Common Multiple
- 受阻碍得中国科技,立刻转向以色列
- mysql数据库基本查询语句操作
- LeetCode12 Predict the Winner
- Gulp知识点
- 算法设计与应用基础-第十二周