标签:老师 ble break show otto 输入数据 problem pre ali
http://acm.hdu.edu.cn/showproblem.php?pid=2021
#include <bits/stdc++.h> using namespace std; int a[111],b[111]; int Money(int n) { int zzt=0; if(n%100==0) zzt+=(n/100); else { int ar; ar=n/100; n=n-ar*100; if(n%50==0) zzt=ar+(n/50); else { int b; b=n/50; n=n-b*50; if(n%10==0) zzt=ar+b+(n/10); else { int c; c=n/10; n=n-c*10; if(n%5==0) zzt=ar+b+c+(n/5); else { int d; d=n/5; n=n-d*5; if(n%2==0) zzt=ar+b+c+d+(n/2); else { int e; e=n/2; n=n-e*2; zzt=ar+b+c+d+e+n; } } } } } return zzt; } int main() { int M; while(cin>>M) { int sum=0; if(M==0) break; for(int i=1; i<=M; i++) { cin>>a[i]; b[i]=Money(a[i]); } for(int i=1; i<=M; i++) { sum+=b[i]; } cout<<sum<<endl; } return 0; }
标签:老师 ble break show otto 输入数据 problem pre ali
原文地址:https://www.cnblogs.com/zlrrrr/p/9226216.html