Saturday, October 17, 2015

주차요금

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.*;

public class Main {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  
  Scanner sc = new Scanner(System.in);
  
  int M = sc.nextInt();
  int[] mList = new int[M]; 
  for(int i=0; i<M; i++){
   mList[i] = sc.nextInt();
  }
  
  int total = 0;
  for(int i=0; i<M; i++){
   
   int subTotal = 0;
   if(mList[i] < 10){
    subTotal = 0;
   }else if(mList[i] >= 10 && mList[i] <= 30){
    subTotal = 500;
   }else{
    subTotal = 500 + (((mList[i] - 31)/10) + 1) * 300;
   }
   
   if(subTotal > 50000){
    subTotal = 50000;
   }
   
   total += subTotal;
   
  }
  
  System.out.println(total);
  
 }

}

No comments:

Post a Comment