結果

問題 No.70 睡眠の重要性!
ユーザー shi-moshi-mo
提出日時 2016-04-05 01:24:42
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 20,352 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 21:38:12
合計ジャッジ時間 714 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,816 KB
testcase_01 AC 0 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 0 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

#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