1093. Air Express
来源:互联网 发布:图纸绘制软件 编辑:程序博客网 时间:2024/05/19 17:06
终于来水题了。
#include <iostream>using namespace std;int main() { int set_number = 0; int weightstd[4], rate[4], m[4]; while(cin >> weightstd[0]) { set_number++; cin >> rate[0] >> weightstd[1] >> rate[1] >> weightstd[2]>> rate[2] >> rate[3];weightstd[3] = 1000;m[0] = 0;for(int i = 1; i < 4; i++) {m[i] = (weightstd[i-1]+1) * rate[i];}cout << "Set number " << set_number << ":" << endl; int custom_weight; while(cin >> custom_weight && custom_weight != 0) { int shouldpay; for(int i = 0; i < 4; i++) { if(custom_weight <= weightstd[i]) { shouldpay = custom_weight * rate[i]; int min = shouldpay, added = 0; for(int j = i + 1; j < 4; j++) { if(m[j] < min) { min = m[j]; added = weightstd[j-1] + 1 - custom_weight; } } cout << "Weight (" << custom_weight << ") has best price $" << min << " (add " << added << " pounds)" << endl; break; } } } cout << endl; } return 0;}
0 0
- 1093. Air Express
- Sicily 1093. Air Express
- Sicily.1093. Air Express
- Sicily 1093. Air Express
- sicily 1093. Air Express
- sicily 1093.Air Express
- sicily 1093. Air Express
- 1093. Air Express
- Sicily 1093. Air Express
- sicily 1093. Air Express
- sicily 1093. Air Express
- [sicily online]1093. Air Express
- Sicily 1093 Air Express
- 1093 Air Express
- Sicily 1093 Air Express
- 1093 Air Express
- AIR Express Install Badge下载及安装(完整版)
- 贪心算法之Air Express——by sicily
- DuiLib : 在CListUI中得到滚动条滚动通知
- hdu 4249 A Famous Equation (dp 细节)
- 教程:使用 MongoDB、WCF、OData 和 PowerBI 构建 Azure 上的商业智能解决方案
- K均值聚类算法
- Material Design入门
- 1093. Air Express
- STL--map用法详解
- ListItemType
- Xcode6模拟器iOS8键盘出不来问题
- C#中客户端和服务端之间实现关机
- 第 0 章 为什么选择《Linux内核源代码情景分析》
- 漫谈递归:递归的思想
- 经典的排错过程 expected unqualified-id before string constant
- codeforces Round #260(div2) E解题报告