結果

問題 No.406 鴨等間隔の法則
ユーザー jhonson1415jhonson1415
提出日時 2020-04-12 02:32:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 358 bytes
コンパイル時間 1,589 ms
コンパイル使用メモリ 166,188 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 13:22:46
合計ジャッジ時間 4,241 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,348 KB
testcase_22 WA -
testcase_23 AC 2 ms
4,348 KB
testcase_24 WA -
testcase_25 AC 2 ms
4,348 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
4,348 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:11:17: warning: 'tmp' may be used uninitialized [-Wmaybe-uninitialized]
   11 |         if(i!=1 and tmp!=now-prev){
      |            ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:7:34: note: 'tmp' was declared here
    7 |     int prev,now; cin>>prev; int tmp;
      |                                  ^~~

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
    int N; cin>>N; 
    int prev,now; cin>>prev; int tmp;
    bool ans=true;
    for(int i=1;i<N-1;i++){
        cin>>now;
        if(i!=1 and tmp!=now-prev){
            ans=false;
            break;
        }
        prev=now;
    }
    cout<<(ans ? "YES" : "NO")<<endl;
}
0