結果

問題 No.481 1から10
ユーザー das08
提出日時 2019-10-25 14:09:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 211 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 58,832 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-19 15:41:48
合計ジャッジ時間 983 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:11: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   12 |     cout<<ans<<endl;
      |           ^~~

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main(){
    int ans;
    vector<int> a(9);
    for (int i=1;i<10;i++){
        cin>>a[i];
        if (a[i]!=i)ans=i+1;
    }
    cout<<ans<<endl;
}
0