結果

問題 No.70 睡眠の重要性!
ユーザー mosmos_21mosmos_21
提出日時 2016-10-05 22:48:19
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 274 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 13:00:45
合計ジャッジ時間 536 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 0 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |   scanf("%d",&n);
      |   ^~~~~~~~~~~~~~
main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d:%d%d:%d",&h1,&m1,&h2,&m2);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
int main(){
  int h1,m1,h2,m2,n,sum=0;
  scanf("%d",&n);
  while(n--){
    scanf("%d:%d%d:%d",&h1,&m1,&h2,&m2);
    h2+=h1>h2?24:m1>m2?24:0; 
    if(m1>m2){h2--;m2+=60;}
    sum+=(h2-h1)*60+m2-m1;
  }
  printf("%d\n",sum);
  return 0;
}
0