๋ฐ์ํ
https://www.acmicpc.net/problem/15953
์ฝ๋
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int T = scan.nextInt();
int[] first = new int[] {500, 300, 200, 50, 30, 10};
int[] second = new int[] {512, 256, 128, 64, 32};
for(int i=0; i<T; i++) {
int money = 0;
int a = scan.nextInt();
int b = scan.nextInt();
if(a == 1)
money += first[0];
else if(a > 1 && a <= 3)
money += first[1];
else if(a > 3 && a <= 6 )
money += first[2];
else if(a > 6 && a <= 10)
money += first[3];
else if(a > 10 && a <= 15)
money += first[4];
else if(a > 15 && a <= 21)
money += first[5];
else
money = 0;
if(b == 1)
money += second[0];
else if(b > 1 && b <= 3)
money += second[1];
else if(b > 3 && b <= 7)
money += second[2];
else if(b > 7 && b <= 15)
money += second[3];
else if(b > 15 && b <= 31)
money += second[4];
System.out.println(money * 10000);
}
scan.close();
}
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int T = scan.nextInt();
int[] first = new int[] {500, 300, 300, 200, 200, 200, 50, 50, 50, 50, 30, 30, 30, 30, 30, 10, 10, 10, 10, 10, 10};
int[] second = new int[] {512, 256, 256, 128, 128, 128, 128, 64, 64, 64, 64, 64, 64, 64, 64,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32};
for(int i=0; i<T; i++) {
int money = 0;
int a = scan.nextInt();
int b = scan.nextInt();
if(a > 0 && a <= 21)
money += first[a-1];
if(b > 0 && b <= 31)
money += second[b-1];
System.out.println(money * 10000);
}
scan.close();
}
}
๋ฐ์ํ
'Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค] 2846๋ฒ: ์ค๋ฅด๋ง๊ธธ (0) | 2020.01.17 |
---|---|
[๋ฐฑ์ค] 14697๋ฒ: ๋ฐฉ ๋ฐฐ์ ํ๊ธฐ (0) | 2020.01.17 |
[๋ฐฑ์ค] 2446๋ฒ: ๋ณ ์ฐ๊ธฐ - 9 (0) | 2020.01.16 |
[๋ฐฑ์ค] 2445๋ฒ: ๋ณ ์ฐ๊ธฐ - 8 (0) | 2020.01.16 |
[๋ฐฑ์ค] 10820๋ฒ: ๋ฌธ์์ด ๋ถ์ (0) | 2020.01.16 |
๋๊ธ