题目描述
某人有8 角的邮票5 张,1 元的邮票4 张,1 元8 角的邮票6 张,用这些邮票中的一张或若干张可以得到多少中不同的邮资?
输入描述:
无
输出描述:
输出一行,表示题目所求。
示例1
输入
无
输出
无
#include <iostream>
#include <set>
using namespace std;
const int arr[3] = {8, 10, 18};
int main() {
set<int> totalPrice;
int i = 0;
for (i = 0; i <= 5; i++) {
for (int j = 0; j <= 4; j++) {
for (int k = 0; k <= 6; k++) {
if (i == 0 && j == 0 && k == 0) {
continue;
}
totalPrice.insert(arr[0]*i+arr[1]*j+arr[2]*k);
}
}
}
cout << totalPrice.size() << endl;
return 0;
}