1 import java.util.Scanner; 2 3 /** 4 * Created by Administrator on 2016/4/4. 5 */ 6 7 8 public class Main { 9 public static void main(String []args) { 10 Scanner in = new Scanner(System.in); 11 for (; ; ) { 12 int c = in.nextInt(); 13 if (c == 0) { 14 System.exit(0); 15 16 } 17 int[] a = new int[c]; 18 int c100=0, c50=0, c10=0, c5=0, c2=0, c1=0; 19 for (int k = 0; k < a.length; k++) { 20 a[k] = in.nextInt(); 21 } 22 int d = 0; 23 for (int j = 0; j < a.length; j++) { 24 25 26 c100 = a[j] / 100; 27 c50 = (a[j] - c100 * 100) / 50; 28 c10 = (a[j] - c100 * 100 - c50 * 50) / 10; 29 c5 = (a[j] - c100 * 100 - c50 * 50 - c10 * 10) / 5; 30 c2 = (a[j] - c100 * 100 - c50 * 50 - c10 * 10 - c5 * 5) / 2; 31 c1 = (a[j] - c100 * 100 - c50 * 50 - c10 * 10 - c5 * 5 - c2 * 2) / 1; 32 33 d= d+c100 +c50 + c10 +c5+c2+c1 ; 34 } 35 System.out.println(d); 36 } 37 } 38 }
时间: 2024-10-06 16:26:05