๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Algorithm

[SW Expert Academy] - (D3)9997. ๋ฏธ๋‹ˆ๋ฉ€๋ฆฌ์ฆ˜ ์‹œ๊ณ„

by ์ฃผ๋ฐœ2 2020. 7. 10.
๋ฐ˜์‘ํ˜•

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AXIvNBzKapEDFAXR&categoryId=AXIvNBzKapEDFAXR&categoryType=CODE

 

SW Expert Academy

SW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”!

swexpertacademy.com

 

์ฝ”๋“œ

import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int t = scan.nextInt();
		for(int tc=1; tc<=t; tc++) {
			int x = scan.nextInt();
			
			int times = x * 2;	 	// 1๋„์— 2๋ถ„
			int hours = times / 60;	// ์‹œ
			times -= (60*hours);	// ๋‚จ์€ ์‹œ๊ฐ„
			
			System.out.println("#" + tc + " " + hours + " " + times);
		}
		
		scan.close();
	}

}

ํ’€์ด

 

์‹œ๊ฐ„ ๊ณ„์‚ฐํ•˜๋Š” ๊ฐ„๋‹จํ•œ ๋ฌธ์ œ.

1๋„์— 2๋ถ„์ด์—ฌ์„œ 2๋ฅผ ๊ณฑํ•˜๊ณ ,

60์„ ๋‚˜๋ˆ  ์‹œ๊ฐ„์„ ๊ตฌํ•˜๊ณ  ๋นผ๋ฉด ๋ถ„์ด ๋œ๋‹ค.

 

 



 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€