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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import java.util.Scanner;
 
public class Main {
    
    public static void main(String[] args)  {
        
        Scanner scanner = new Scanner(System.in);
 
        int num=scanner.nextInt();
        double[] result = new double[num];
        List mid = new ArrayList<>();
        int mmid;
        int cnt=0;
    
        for(int j=0;j<num;j++) {
            int arr=scanner.nextInt();
            int k= arr;
            
            for(int i=0;i<arr;i++) {
            
            mmid=scanner.nextInt();
            
            mid.add(mmid);    
            
            result[j] += mmid;
            
            }
            result[j] /= k; 
 
            for(int k1=0;k1<mid.size();k1++) {
                
                if((int)result[j] <((int)mid.get(k1)))
                        cnt++;
                
            
                
            }
            
            mid.clear();
            result[j]= (cnt/(double)k)*100;
            
            cnt=0;
        }
        
        for(int j=0;j<num;j++) {
            System.out.printf("%.3f",result[j]);
            System.out.println("%");
            }
        
    
    
        
    }
    
    
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4f; text-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none; color:white">cs

'알고리즘' 카테고리의 다른 글

백준 10818번 자바(JAVA)  (0) 2019.10.14
프로그래머스/LEV2 타겟 넘버 자바  (0) 2019.10.10
백준 1110번 자바 성공코드  (0) 2019.06.20
백준 15552번 자바 성공코드  (0) 2019.06.14
백준 11721번 자바 성공 코드  (0) 2019.06.13

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

41

42

import java.io.BufferedReader;

import java.io.BufferedWriter;

import java.io.IOException;

import java.io.InputStreamReader;

import java.io.OutputStreamWriter;

import java.util.StringTokenizer;

 

public class Main {

 

    public static void main(String[] args) throws IOException {

    

        

        

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        

        

        StringTokenizer st;

        

        int num = Integer.parseInt(in.readLine());

        

        int[] arr = new int[num];

        

        for(int i=0;i<num;i++) {

            st = new StringTokenizer(in.readLine());

            arr[i]=Integer.parseInt(st.nextToken())+Integer.parseInt(st.nextToken());

            

            

        }

        

        for (int i=0 ;i<num;i++) {

            out.write(String.valueOf(arr[i]));

            out.newLine();

        }

        

        

        out.flush();

        out.close();

    }

    

}

 

Colored by Color Scripter

cs

'알고리즘' 카테고리의 다른 글

백준 10818번 자바(JAVA)  (0) 2019.10.14
프로그래머스/LEV2 타겟 넘버 자바  (0) 2019.10.10
백준 1110번 자바 성공코드  (0) 2019.06.20
백준 4344 자바 성공코드  (0) 2019.06.20
백준 11721번 자바 성공 코드  (0) 2019.06.13

'알고리즘' 카테고리의 다른 글

백준 10818번 자바(JAVA)  (0) 2019.10.14
프로그래머스/LEV2 타겟 넘버 자바  (0) 2019.10.10
백준 1110번 자바 성공코드  (0) 2019.06.20
백준 4344 자바 성공코드  (0) 2019.06.20
백준 15552번 자바 성공코드  (0) 2019.06.14

+ Recent posts