문제
https://www.acmicpc.net/problem/6502
6502번: 동혁 피자
대전 ACM-ICPC Regional가 끝나면, 대회 참가자들은 다같이 카이스트 근처의 동혁 피자에 간다. 대회는 5시간동안 진행되므로, 참가자는 모두 배가 매우 고프다. 피자를 최대한 빨리 먹기 위해서, 큰
www.acmicpc.net
내가 작성한 코드
import java.io.*;
public class 백준6502 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int i = 1;
while(true){
String[] input = br.readLine().split(" ");
if(input[0].equals("0")){
break;
}
int a = Integer.parseInt(input[0]);
int b = Integer.parseInt(input[1]);
int c = Integer.parseInt(input[2]);
int daedae = b*b + c*c;
double dae = Math.pow(daedae,0.5);
if((a*2)>=dae){
bw.write("Pizza "+i+" fits on the table.");
}
else{
bw.write("Pizza "+i+" does not fit on the table.");
}
bw.newLine();
i++;
}
bw.close();
}
}
'자바 > 백준' 카테고리의 다른 글
[백준 10769] 행복한지 슬픈지 (0) | 2022.09.08 |
---|---|
[백준 1158] 요세푸스 문제 (0) | 2022.09.07 |
[백준 2440] 별 찍기 - 3 (0) | 2022.09.06 |
[백준 2083] 럭비 클럽 (0) | 2022.09.06 |
[백준 1264] 모음의 개수 (0) | 2022.09.06 |