SWEA_2071) 평균값 구하기
SWEA
# D1
2071) 평균값 구하기 (19.10.02)
문제 링크 (SW Expert Academy)
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
|
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer tk;
int t = Integer.parseInt(br.readLine());
for(int p=1;p<=t;p++) {
double sum = 0.0;
tk = new StringTokenizer(br.readLine());
for(int i=0;i<10;i++) {
int a = Integer.parseInt(tk.nextToken());
sum = sum+a;
}
if(sum/10 - (int)sum/10 >=0.5) bw.write("#" + p + " " + (int)((sum/10)+1) + "\n");
else bw.write("#" + p + " " + (int)(sum/10) + "\n");
}
bw.flush();
bw.close();
}
}
| cs |
댓글
댓글 쓰기