[백준]10162.전자레인지/Java

seeun·2021년 9월 28일
0

BaekJoon

목록 보기
8/10
post-thumbnail

📃전자레인지


👩🏻‍💻풀이

import java.util.Scanner;

public class microwave_10162 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int time = sc.nextInt();
		int[] count = new int[3];
		int temp = time;
		
		
		if(time >= 300) {
			count[0] = time / 300;
			temp = time % 300;
		}
		if(temp >= 60) {
			count[1] = temp / 60;
			temp = temp % 60;
		}
		if(temp >= 10) {
			count[2] = temp / 10;
			temp = temp % 10;
		}
		
		if(temp != 0) {
			System.out.println(-1);
		}
		else {
			for(int c : count) {
				System.out.print(c);
				System.out.print(" ");
			}
		}
	}
}
profile
🤹‍♂️개발 기록 노트

0개의 댓글