Submission #213506

# Submission time Handle Problem Language Result Execution time Memory
213506 2020-03-26T03:24:50 Z berryzed 님 무기가 좀 나쁘시네여 (kriii3_S) Java 11
0 / 29
122 ms 13548 KB
import java.util.Scanner;

public 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);
		float[][][] players = new float[2][4][5];

		for (int i = 0; i < 2; i++) { // 장착여부
			for (int j = 0; j < 2; j++) { // 사람
				for (int k = 0; k < 5; k++) {
					players[j][i][k] = scanner.nextInt();
				}
			}
		}

		// 맨 몸 데이터 입력
		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];
		}

		float p1Current = getCombatPower(players[P1][CURRENT]);
		float p1Another = getCombatPower(players[P1][ANOTHER]);

		float p2Current = getCombatPower(players[P2][CURRENT]);
		float 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);
	}

	private static float getCombatPower(float[] datas) {
		float attack = datas[0];
		float power = datas[1];
		float criChance = (datas[2] / 100.0f);
		float criDamRate = (datas[3] / 100.0f);
		float atkSpeed = (datas[4] / 100.0f);

		float phase0 = 1 - Math.min(criChance, 100);
		float phase1 = phase0 + Math.min(criChance, 100) * criDamRate;
		float phase2 = 1 + atkSpeed;
		return attack * (1 + power / 100.0f) * phase1 * phase2;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 122 ms 13548 KB Output isn't correct
2 Halted 0 ms 0 KB -