結果
| 問題 | 
                            No.296 n度寝
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-12-28 15:15:11 | 
| 言語 | TypeScript  (5.7.2)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 626 bytes | 
| コンパイル時間 | 8,790 ms | 
| コンパイル使用メモリ | 229,128 KB | 
| 実行使用メモリ | 39,552 KB | 
| 最終ジャッジ日時 | 2024-12-31 16:41:44 | 
| 合計ジャッジ時間 | 10,682 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 WA * 6 | 
ソースコード
import {readFileSync} from 'fs';
function addTime(
  hour: number,
  min: number,
  minAdd: number
): {hour: number; min: number} {
  const hourAdd = Math.floor(minAdd / 60);
  const newMin = min + minAdd;
  const newHour = hour + hourAdd;
  return {
    hour: newHour % 24,
    min: newMin % 60,
  };
}
function main(input: string) {
  const data = input.split('\n');
  const [times, hour, min, interval] = data[0]
    .split(' ')
    .map(value => parseInt(value));
  const res = addTime(hour, min, interval * (times - 1));
  console.log(res.hour);
  console.log(res.min);
}
main(readFileSync('/dev/stdin', 'utf8'));