結果
| 問題 |
No.296 n度寝
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-07 14:27:03 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 1,000 ms |
| コード長 | 1,932 bytes |
| コンパイル時間 | 931 ms |
| コンパイル使用メモリ | 110,108 KB |
| 実行使用メモリ | 26,200 KB |
| 最終ジャッジ日時 | 2024-09-21 04:53:05 |
| 合計ジャッジ時間 | 2,177 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace yukicoder
{
class Program
{
static void Main(string[] args)
{
string[] str = Console.ReadLine().Split(' ');
//N度寝する
int N = int.Parse(str[0]);
//時
int H = int.Parse(str[1]);
//分
int M = int.Parse(str[2]);
//T分後にアラームが鳴る
int T = int.Parse(str[3]);
int a = 0;
int b = 0;
int c = 0;
//何回で起きられるか
a = N - 1;
//何分後に起きるか
b = a * T;
//Mからbをたす
c = b + M;
//何回ループするか
int ans = c / 60;
//60分超えたらHに+1する
for (int i = 0; i < ans+1; i++)
{
//cが60超えるなら
if (c >= 60)
{
//Hをプラス1する
H += 1;
c -= 60;
if(c>=60)
{
continue;
}
}
if (c < 60)
{
break;
}
}
//24時間超えたらHを0にする
for (int i = 0; i < ans + 1; i++)
{
//Hが24になったら
if (H >= 24)
{
int x = H - 24;
H = 0;
H += x;
if (H >= 24)
{
continue;
}
}
if(H<24)
{
break;
}
}
//表示 時間 分
Console.WriteLine(H);
Console.WriteLine(c);
}
}
}