結果
| 問題 | No.296 n度寝 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-09-17 21:25:16 | 
| 言語 | TypeScript (5.7.2) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 68 ms / 1,000 ms | 
| コード長 | 1,109 bytes | 
| コンパイル時間 | 8,400 ms | 
| コンパイル使用メモリ | 228,512 KB | 
| 実行使用メモリ | 39,424 KB | 
| 最終ジャッジ日時 | 2024-12-31 16:20:19 | 
| 合計ジャッジ時間 | 10,167 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 | 
ソースコード
import { readFileSync } from 'fs';
// Nはユキさんが度寝することを示します。
// Hはアラームが最初に鳴る時刻の、24時間制における時の値です。
// Mはアラームが最初に鳴る時刻の、分の値です。
// Tは最初にアラームが鳴った後、アラームが繰り返される間隔の、分単位の値です。
function Main(input: string) {
  const data = input.split('\n');
  const firstLine = data[0].split(' ').map(Number);
  const N = firstLine[0];
  const H = firstLine[1];
  const M = firstLine[2];
  const T = firstLine[3];
  const delayMinutes = (N - 1) * T;
  const addHours = Math.floor(delayMinutes / 60);
  const addMinutes = delayMinutes % 60;
  let getUpHour = (H + addHours) % 24;
  let getUpMinutes = M + addMinutes;
  if (getUpMinutes > 60) {
    getUpHour++;
    getUpMinutes = getUpMinutes % 60;
  }
  if (getUpMinutes === 60) {
    getUpHour++;
    getUpMinutes = 0;
  }
  if (getUpHour === 24) {
    getUpHour = 0;
  }
  console.log(getUpHour);
  console.log(getUpMinutes);
}
Main(readFileSync('/dev/stdin', 'utf8'));
            
            
            
        