import java.util.Scanner;
/**
* https://oj.uz/problem/view/kriii3_S
* <p>
* https://oj.uz/submission/19070
* https://oj.uz/submission/15556
*/
class relay {
private final static int P1 = 0; // 크리
private final static int P2 = 1; // 파부
private final static int CURRENT = 0; // 자기 무기 장착 후 데이터
private final static int WEAPON = 1; // 무기 데이터
private final static int BODY = 2; // 맨몸 데이터
private final static int ANOTHER = 3; // 상대방 무기 장착 후 데이터
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
long[][][] players = new long[2][4][5];
for (int i = 0; i < 2; i++) { // 장착여부
for (int j = 0; j < 2; j++) { // 사람
for (int k = 0; k < 5; k++) {
String data = scanner.next().trim();
players[j][i][k] = Long.parseLong(data);
}
}
}
// 맨 몸 데이터 입력
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 5; j++) {
players[i][BODY][j] = players[i][CURRENT][j] - players[i][WEAPON][j];
}
}
// 상대방 무기 장착 데이터 입력
for (int j = 0; j < 5; j++) {
players[P1][ANOTHER][j] = players[P1][BODY][j] + players[P2][WEAPON][j];
players[P2][ANOTHER][j] = players[P2][BODY][j] + players[P1][WEAPON][j];
}
long p1Current = getCombatPower(players[P1][CURRENT]);
long p1Another = getCombatPower(players[P1][ANOTHER]);
long p2Current = getCombatPower(players[P2][CURRENT]);
long p2Another = getCombatPower(players[P2][ANOTHER]);
char p1Changed = p1Current > p1Another ? '-' : p1Current < p1Another ? '+' : '0';
char p2Changed = p2Current > p2Another ? '-' : p2Current < p2Another ? '+' : '0';
System.out.println(p1Changed);
System.out.println(p2Changed);
}
public static long getCombatPower(long[] datas) {
long attack = datas[0];
long power = datas[1];
long criChance = datas[2];
long criDamRate = datas[3];
long atkSpeed = datas[4];
return attack * (100 + power) * (10000 - 100 * Math.min(100, criChance) + Math.min(100, criChance) * criDamRate) * (100 + atkSpeed);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
120 ms |
13544 KB |
Output is correct |
2 |
Correct |
119 ms |
13272 KB |
Output is correct |
3 |
Correct |
119 ms |
13616 KB |
Output is correct |
4 |
Correct |
119 ms |
13468 KB |
Output is correct |
5 |
Correct |
121 ms |
14132 KB |
Output is correct |
6 |
Correct |
118 ms |
13584 KB |
Output is correct |
7 |
Correct |
119 ms |
13832 KB |
Output is correct |
8 |
Correct |
129 ms |
13556 KB |
Output is correct |
9 |
Correct |
120 ms |
13592 KB |
Output is correct |
10 |
Correct |
122 ms |
13412 KB |
Output is correct |
11 |
Correct |
119 ms |
13796 KB |
Output is correct |
12 |
Correct |
118 ms |
13400 KB |
Output is correct |
13 |
Correct |
119 ms |
13964 KB |
Output is correct |
14 |
Correct |
124 ms |
13940 KB |
Output is correct |
15 |
Correct |
121 ms |
13416 KB |
Output is correct |
16 |
Correct |
116 ms |
13364 KB |
Output is correct |
17 |
Correct |
124 ms |
13352 KB |
Output is correct |
18 |
Correct |
125 ms |
13840 KB |
Output is correct |
19 |
Correct |
122 ms |
13812 KB |
Output is correct |
20 |
Correct |
121 ms |
13556 KB |
Output is correct |
21 |
Correct |
120 ms |
13820 KB |
Output is correct |
22 |
Correct |
118 ms |
13856 KB |
Output is correct |
23 |
Correct |
117 ms |
13724 KB |
Output is correct |
24 |
Correct |
120 ms |
13812 KB |
Output is correct |
25 |
Correct |
121 ms |
13800 KB |
Output is correct |
26 |
Correct |
120 ms |
13328 KB |
Output is correct |
27 |
Correct |
114 ms |
13420 KB |
Output is correct |
28 |
Correct |
131 ms |
13708 KB |
Output is correct |
29 |
Correct |
119 ms |
13428 KB |
Output is correct |
30 |
Correct |
122 ms |
13712 KB |
Output is correct |
31 |
Correct |
119 ms |
13824 KB |
Output is correct |
32 |
Correct |
122 ms |
13560 KB |
Output is correct |
33 |
Correct |
118 ms |
13468 KB |
Output is correct |
34 |
Correct |
120 ms |
13596 KB |
Output is correct |
35 |
Correct |
126 ms |
13176 KB |
Output is correct |
36 |
Correct |
120 ms |
13808 KB |
Output is correct |
37 |
Correct |
118 ms |
13460 KB |
Output is correct |
38 |
Correct |
121 ms |
14024 KB |
Output is correct |
39 |
Correct |
119 ms |
13800 KB |
Output is correct |
40 |
Correct |
120 ms |
13932 KB |
Output is correct |
41 |
Correct |
120 ms |
13300 KB |
Output is correct |
42 |
Correct |
118 ms |
14028 KB |
Output is correct |
43 |
Correct |
118 ms |
13676 KB |
Output is correct |
44 |
Correct |
115 ms |
13640 KB |
Output is correct |
45 |
Correct |
122 ms |
13528 KB |
Output is correct |
46 |
Correct |
119 ms |
13588 KB |
Output is correct |