Sicily 1093. Air Express
来源:互联网 发布:微信一夜暴富软件 编辑:程序博客网 时间:2024/05/19 19:40
#include <iostream>using namespace std;int arr[1000000];int main(){int n1,p1,n2,p2,n3,p3,p4,k=1;while(cin >> n1){cin >> p1 >> n2 >> p2 >> n3 >> p3 >> p4;int n=0;while(true){cin >> arr[n];if(arr[n]==0)break;else n++;}cout << "Set number " << k << ":" << endl;k++;for(int i=0; i < n; ++i){int price1=0,price2=0;if(arr[i] <= n1 && arr[i]>= 0){price1=arr[i]*p1;price2=(n1+1)*p2;if(price1 <= price2) cout << "Weight (" << arr[i] << ") has best price $" << price1 << " (add 0 pounds)" << endl;else cout << "Weight (" << arr[i] << ") has best price $" << price2 << " (add " << n1+1-arr[i] << " pounds)" << endl;}else if(arr[i] <= n2 && arr[i]>= n1+1){price1=arr[i]*p2;price2=(n2+1)*p3;if(price1 <= price2) cout << "Weight (" << arr[i] << ") has best price $" << price1 << " (add 0 pounds)" << endl;else cout << "Weight (" << arr[i] << ") has best price $" << price2 << " (add " << n2+1-arr[i] << " pounds)" << endl;}else if(arr[i] <=n3 && arr[i] >= n2+1){price1=arr[i]*p3;price2=(n3+1)*p4;if(price1 <= price2) cout << "Weight (" << arr[i] << ") has best price $" << price1 << " (add 0 pounds)" << endl;else cout << "Weight (" << arr[i] << ") has best price $" << price2 << " (add " << n3+1-arr[i] << " pounds)" << endl;}else if(arr[i] >= n3+1) cout << "Weight (" << arr[i] << ") has best price $" << p4*arr[i] << " (add 0 pounds)" << endl;}cout << endl;}}
0 0
- Sicily 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
- sicily 1093. Air Express
- sicily 1093. Air Express
- [sicily online]1093. Air Express
- Sicily 1093 Air Express
- Sicily 1093 Air Express
- 1093. Air Express
- 1093. Air Express
- 贪心算法之Air Express——by sicily
- 1093 Air Express
- 1093 Air Express
- AIR Express Install Badge下载及安装(完整版)
- 高性能索引
- Java资源
- linux下使用优盘的方法
- leetcode--House Robber
- HDU 1098 Ignatius's Puzzle(解法汇集)
- Sicily 1093. Air Express
- IOS中获取各种文件的目录路径的方法
- netty入门实例
- Sicily 2014. Dairy Queen
- java反射 静态类
- PCL 1.8.0 VS2010 x64源码编译
- weblogic的Serverlog内容自定义
- BitMap同时绘制Matrix和ColorMatrix
- 自定义viewgroup实践之仿写LinearLayout