โ์ช ์ ํจ๊ป ํ๋ฃจ์ 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);
}
}