結果

問題 No.904 サメトロ
ユーザー function6161
提出日時 2019-10-16 17:59:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 276 bytes
コンパイル時間 1,647 ms
コンパイル使用メモリ 53,784 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-22 14:09:01
合計ジャッジ時間 1,511 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:4:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |     scanf("%d",&a);
      |     ~~~~~^~~~~~~~~
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d %d",&b[i],&c[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
int main(){
        int a,x=0,y=0;
    scanf("%d",&a);
    int b[a-1],c[a-1];
    for(int i=0;i<a-1;i++){
        scanf("%d %d",&b[i],&c[i]);
        x+= *(b+i);
        y+= *(c+i);
    }
    if(a==2)std::cout << 1;
    else std::cout << std::min(x,y)+1;
}
0