結果

問題 No.296 n度寝
コンテスト
ユーザー nanatutmc
提出日時 2019-09-28 00:36:15
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 269 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 93 ms
コンパイル使用メモリ 29,740 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-08 16:21:13
合計ジャッジ時間 677 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:15:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
   15 |     printf("%d\n%d\n", minute/60, minute%60);
      |             ~^         ~~~~~~~~~
      |              |               |
      |              int             long int
      |             %ld
main.c:15:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
   15 |     printf("%d\n%d\n", minute/60, minute%60);
      |                 ~^                ~~~~~~~~~
      |                  |                      |
      |                  int                    long int
      |                 %ld
main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d %d %d %d", &N, &H, &M, &T);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include <stdio.h>

main() {
    int N, H, M, T;
    scanf("%d %d %d %d", &N, &H, &M, &T);
    
    long minute = H*60+M;
    
    minute += T*(N-1);
    
    while (minute >= 24*60) {
        minute -= 24*60;
    }
    
    printf("%d\n%d\n", minute/60, minute%60);
}
0