๋ฐ์ํ
https://codeforces.com/problemset/problem/677/A
์ฝ๋
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int h = scan.nextInt();
int[] arr = new int[n];
int sum = 0;
for(int i=0; i<n; i++) {
arr[i] = scan.nextInt();
sum += (arr[i] <= h) ? 1 : 2 ;
}
System.out.println(sum);
scan.close();
}
}
ํ์ด
์ฃผ์ด์ง h(๋์ด)๋ณด๋ค ์ฌ๋์ ๋์ด๋ณด๋ค ์๊ฑฐ๋ ๊ฐ์ผ๋ฉด 1์ ๋ํ๊ณ , ํฌ๋ฉด 2๋ฅผ ๋ํ๋ค.
๋ฐ์ํ
'Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
ํ๋ก๊ทธ๋๋จธ์ค[Java] - ์ง์ง์ด ์ ๊ฑฐํ๊ธฐ (0) | 2020.03.02 |
---|---|
[๋ฐฑ์ค] 11727๋ฒ: 2xn ํ์ผ๋ง 2 (0) | 2020.03.02 |
[๋ฐฑ์ค] 4641๋ฒ: Doubles(์์ ํ์) (0) | 2020.02.29 |
[๋ฐฑ์ค] 2156๋ฒ: ํฌ๋์ฃผ ์์(DP) (0) | 2020.02.28 |
[๋ฐฑ์ค] 2437๋ฒ: ์ ์ธ(๊ทธ๋ฆฌ๋) (0) | 2020.02.28 |
๋๊ธ