标签:hdu
3 1 2 3 0
4
#include <iostream> using namespace std; int main() { int n; while (cin >> n && n) { int num,result =0; while (n--) { int mon; cin >> mon; if (mon / 100 !=0) { result = result +mon/100; num = mon /100; mon = mon - num*100; } if (mon / 50 !=0) { result =result +mon/50; num = mon/50; mon = mon - num*50; } if (mon /10 !=0) { result =result +mon/10; num = mon/10; mon = mon- 10*num; } if (mon / 5!=0) { result =result + mon /5; num = mon / 5; mon= mon - 5*num; } if (mon / 2!=0) { result = result +mon/2; num = mon / 2; mon = mon- 2*num; } result = result +mon; } cout << result <<endl; } return 0; }
标签:hdu
原文地址:http://blog.csdn.net/xiaotan1314/article/details/46045229