๐Ÿ”ฅBaekjoon start๐Ÿ”ฅ

arielยท2021๋…„ 11์›” 8์ผ
0

Baekjoon

๋ชฉ๋ก ๋ณด๊ธฐ
6/14
post-thumbnail

2021-11-08

โœ์ช ์™€ ํ•จ๊ป˜ ํ•˜๋ฃจ์— 30๋ถ„ ์ด์ƒ ์‹œ์ž‘โœจ

4344

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int[] arr;
	
	int testcase = sc.nextInt();

    	for(int i=0; i<testcase; i++){	
    		int N = sc.nextInt(); //ํ•™์ƒ ์ˆ˜ 
    		arr = new int[N]; 
    		
    		double sum = 0; //์„ฑ์  ๋ˆ„์  ํ•ฉ ๋ณ€์ˆ˜
         
    	//์„ฑ์  ์ž…๋ ฅ๋ถ€๋ถ„	
        for(int j = 0; j<N; j++) {
        	int val = sc.nextInt(); //์„ฑ์  ์ž…๋ ฅ
        	arr[j] = val;
        	sum += val; //์„ฑ์  ๋ˆ„์  ํ•ฉ
        }
        double mean = (sum / N);
        double count = 0; //ํ‰๊ท  ๋„˜๋Š” ํ•™์ƒ ์ˆ˜ ๋ณ€์ˆ˜
        
        //ํ‰๊ท  ๋„˜๋Š” ํ•™์ƒ ๋น„์œจ ์ฐพ๊ธฐ
        for(int j = 0; j<N; j++) {
        	if(arr[j]>mean) {
        		count++;
        	}
        }
        System.out.printf("%.3f%%\n",(count/N)*100);
    	}
        }
	     
    }

11654

import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
 
		Scanner in = new Scanner(System.in);
 
		int ch = in.next().charAt(0);
        
		System.out.print(ch);
	}
}

11720

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);

	int N = sc.nextInt(); //์ˆซ์ž์˜ ๊ฐœ์ˆ˜
	String a = sc.next(); //๊ณต๋ฐฑ์—†๋Š” ์ˆซ์ž์ด๊ธฐ์— ๋ฌธ์ž๋กœ ์ˆซ์ž๋ฅผ ์ž…๋ ฅ๋ฐ›์Œ
	sc.close();
	int sum = 0;
	
	for(int i=0; i<N; i++) {
		sum += a.charAt(i)-'0'; //"a.charAt(i)-'0'"์•„์Šคํ‚ค๋ฌธ์ž๋กœ ๋ณ€ํ™˜ํ•˜์ง€ ์•Š๊ธฐ ์œ„ํ•ด
	}
		System.out.println(sum);

	}
	}

0๊ฐœ์˜ ๋Œ“๊ธ€