結果

問題 No.70 睡眠の重要性!
コンテスト
ユーザー shi-mo
提出日時 2016-04-05 01:24:42
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 385 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 168 ms
コンパイル使用メモリ 28,996 KB
最終ジャッジ日時 2026-02-23 21:03:37
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |     scanf("%d\n", &n);
      |     ^~~~~~~~~~~~~~~~~
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%d:%d %d:%d\n", &h1, &m1, &h2, &m2);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include <stdio.h>

#define DAY (24*60)

int
main(int argc, char *argv[])
{
    int n, i, total = 0;
    scanf("%d\n", &n);

    for (i = 0; i < n; i++) {
        int h1, m1, h2, m2, time;
        scanf("%d:%d %d:%d\n", &h1, &m1, &h2, &m2);
        time = (60*h2 + m2) - (60*h1 + m1);
        total += (0 <= time) ? time : (DAY+time);
    }
    printf("%d\n", total);

    return 0;
}
0