結果

問題 No.525 二度寝の季節
コンテスト
ユーザー YamaKasa
提出日時 2018-05-06 18:38:36
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 58 ms / 1,000 ms
コード長 1,052 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,845 ms
コンパイル使用メモリ 84,176 KB
実行使用メモリ 46,776 KB
最終ジャッジ日時 2026-03-16 11:31:04
合計ジャッジ時間 4,581 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String T = scan.next();
		scan.close();
		int h;
		if(T.charAt(0) == '0') {
			h = Integer.parseInt(T.substring(1, 2));
		}else {
			h = Integer.parseInt(T.substring(0, 2));
		}
		int m;
		if(T.charAt(3) == '0') {
			m = Integer.parseInt(T.substring(4, 5));
		}else {
			m = Integer.parseInt(T.substring(3, 5));
		}
		if(m > 54) {
			if(h == 23) {
				int m1 = m + 5 - 60;
				System.out.println("00:0" + m1);
			}else {
				int m1 = m + 5 - 60;
				if(h < 9) {
					int h1 = h + 1;
					System.out.println("0" + h1 + ":0" + m1);
				}else {
					int h1 = h + 1;
					System.out.println(h1 + ":0" + m1);
				}

			}
		}else if(m < 4) {
			int m1 = m + 5;
			if(h < 9) {
				System.out.println("0" + h +":0" + m1);
			}else {
				System.out.println(h + ":0" + m1);
			}
		}else {
			int m1 = m + 5;
			if(h < 10) {
				System.out.println("0" + h +":" + m1);
			}else {
				System.out.println(h + ":" + m1);
			}
		}

	}
}
0