結果
| 問題 |
No.296 n度寝
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-16 17:18:10 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,421 bytes |
| コンパイル時間 | 2,037 ms |
| コンパイル使用メモリ | 77,348 KB |
| 実行使用メモリ | 41,800 KB |
| 最終ジャッジ日時 | 2024-06-28 10:50:12 |
| 合計ジャッジ時間 | 5,146 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 RE * 4 |
ソースコード
import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int h = sc.nextInt();
int m = sc.nextInt();
int t = sc.nextInt();
Time time = new Time(h, m);
if (n <= 1) {
time.getTime();
System.exit(1);
}
time.setMin((n - 1) * t);
time.getTime();
}
}
class Time {
private int hour;
private int min;
public Time(int a, int b) {
hour = a;
min = b;
}
public void setTime(int a, int b) {
if (min + b >= 60) {
hour++;
this.min = Math.abs(min - b);
} else {
this.min += b;
}
if (hour + a >= 24) {
this.hour = Math.abs((24 - this.hour) - a);
} else {
this.hour += a;
}
}
public void setMin(int a) {
int m = this.min + a;
int h = this.hour;
if (m >= 60) {
h = this.hour + (int)Math.floor(m / 60);
m = m % 60;
}
if (h >= 24) {
h = h % 24;
}
this.hour = h;
this.min = m;
}
public void getTime() {
System.out.println(this.hour);
System.out.println(this.min);
}
}