码迷,mamicode.com
首页 > 其他好文 > 详细

acm 2021 发工资咯

时间:2016-04-06 18:23:13      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:

 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 }

 

acm 2021 发工资咯

标签:

原文地址:http://www.cnblogs.com/chengxu-suanfa/p/5360401.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!