[๋ฌธ์ ๋งํฌ]
https://www.acmicpc.net/problem/15953
[ํ์ด์์ค]
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
60
61
62
|
package Algorithm;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class KakaoFestival {
public static int[] prize2017= {500,300,200,50,30,10};
public static int[] prize2018= {512,256,128,64,32};
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=null;
StringBuilder sb=new StringBuilder();
int testcase=Integer.parseInt(br.readLine());
for (int i=0;i<testcase;i++) {
st=new StringTokenizer(br.readLine());
int rank2017=Integer.parseInt(st.nextToken());
int rank2018=Integer.parseInt(st.nextToken());
int total=calcPrize(rank2017, rank2018);
}
System.out.println(sb);
}
public static int calcPrize(int rank2017, int rank2018) {
int reward2017=0;
int reward2018=0;s
int total=0;
if (rank2017>0 && rank2017<22) {
for(int i=1; i<=6; i++) {
rank2017-=i;
if((rank2017)<=0) {
reward2017=prize2017[i-1];
}
if (reward2017!=0) break;
}
}
if (rank2018>0 && rank2018<32) {
for(int i=0; i<=4; i++) {
if(rank2018<=0) {
reward2018=prize2018[i];
}
if (reward2018!=0) break;
}
}
total=reward2017+reward2018;
return total*10000;
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
[๋๋์ ]
- ์ ๋ ฅ์ฒ๋ฆฌ ๊ณต๋ถ
- ์ฌ๊ทํจ์ ์ฌ์ฉ
- ์กฐ๊ฑด๋ฌธ์ด ๋๋ฌด ๋ง์๊ฒ๊ฐ์
- ๋ค๋ฅธ์ฌ๋๋ค์ด ํ์ดํ๊ฑธ ๋ณด๋ ๋ฐฐ์ด๋ก ๋ชจ๋ ๊ฐ๋ค์ ํ์ฉํ๋๊ฒ์ด ๋ง์์
→ ๋๋ ๊ท์น์ ์ฐพ์ ๊ทธ ๊ฐ์ ๊ผญ ๋ง๋ค์ด๋ด๋ ค๊ณ ํ๋๋ฐ,
์๊ฐ์ ์ฝ์ ์ํด์ ์์ผ๋ก๋ ๊ตณ์ด ๊ทธ๋ด ํ์๊ฐ ์๋ค๋ ๊ฒ!
'Algoritm > Quiz-Solutions' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Leetcode 1] two Sum (0) | 2020.08.02 |
---|---|
[๋ฐฑ์ค 2156] ํฌ๋์ฃผ ์์ (Java) - DP (0) | 2020.05.07 |
[๋ฐฑ์ค 1260] DFS์ BFS (Java) - DFS,BFS (0) | 2020.05.07 |
[๋ฐฑ์ค 9012] ๊ดํธ(Java) - Stack (0) | 2020.05.04 |
[๋ฐฑ์ค 10854] ํ (JAVA) - Queue (0) | 2020.05.03 |
๋๊ธ