結果

問題 No.185 和風
ユーザー tmbsx
提出日時 2015-04-27 20:24:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 244 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 53,852 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 04:54:43
合計ジャッジ時間 854 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:23: warning: ‘o’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   15 |   if(o>0&&p==0) cout<<o<<endl;
      |                       ^

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
  int l,m,n,o,p;
  p=0;
  cin >>l;

  for(int i=0;i<l;i++){
    cin >>n>>m;

    if(i==0) o=m-n;
    else if(p==0 && o!=m-n) p=1;
  }
  if(o>0&&p==0) cout<<o<<endl;
  else cout <<-1<<endl;
}
0