結果

問題 No.481 1から10
コンテスト
ユーザー Daylight
提出日時 2018-05-13 15:32:15
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 936 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 690 ms
コンパイル使用メモリ 106,392 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-17 00:02:33
合計ジャッジ時間 1,188 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:35:13: warning: 'last' may be used uninitialized [-Wmaybe-uninitialized]
   35 |     if(next - last != 1){
      |        ~~~~~^~~~~~
main.cpp:32:9: note: 'last' was declared here
   32 |     int last ;
      |         ^~~~

ソースコード

diff #
raw source code

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <complex>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <typeinfo>
#include <cassert>
#include <fstream>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i = a;i<b;i++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;

int main (){
  string s;
  bool b = false;
  while (cin >> s){
    int last ;
    int next ;
    sscanf(s.c_str(),"%d",&next);
    if(next - last != 1){
      cout << last + 1 << endl ;
      b = true;
      break;
    }
    
    last = next;
  }
  if(!b) cout  << 10 << endl;
  return 0;
}
0