結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-03-14 20:04:51 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 424 bytes | 
| コンパイル時間 | 159 ms | 
| コンパイル使用メモリ | 22,272 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-29 01:03:24 | 
| 合計ジャッジ時間 | 645 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d:%d %d:%d",&H,&M,&h,&m);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int main(){
    //iuput
    int N;
    scanf("%d",&N);
    int total = 0;
    for (int i = 0;i < N;i++){
        int H,M,h,m;
        scanf("%d:%d %d:%d",&H,&M,&h,&m);
        int start = 60*H+M;
        int end = 60*h+m;
        if (start <= end){
            total += end-start;
        }else{
            total += 1440-start+end;
        }
    }
    //output
    printf("%d\n",total);
    return 0;
}
            
            
            
        