标签:
Time Limit: 1000MS | Memory Limit: 65536KB | 64bit IO Format: %I64d & %I64u |
Description
Input
Output
Sample Input
input | output |
---|---|
0 2 0 0 0 0 10 |
5 6 7 8 9 10 |
1 2 0 0 0 0 10 |
1 11 |
上限是sum/m,下限是sum-最小面值的一个还要再加一。
#include<iostream> using namespace std; int a[10]; void init() { a[0] = 10; a[1] = 50; a[2] = 100; a[3] = 500; a[4] = 1000; a[5] = 5000; } int b[10]; int main() { init(); int m; while (cin >> b[0]) { cin >> b[1] >> b[2] >> b[3] >> b[4] >> b[5]; cin >> m; int min; for (int i = 0; i < 6; i++) { if (b[i]) { min = i; break; } } int sum = 0; for (int i = 0; i <6; i++) sum = sum + b[i] * a[i]; int high = sum / m; int low=(sum - a[min]) / m; cout << high - low << endl; for (int i = low+1; i <= high; i++) cout << i << " "; cout << endl; } }
标签:
原文地址:http://blog.csdn.net/qq_18738333/article/details/45161577