結果

問題 No.185 和風
ユーザー tmbsxtmbsx
提出日時 2015-04-27 20:24:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 244 bytes
コンパイル時間 1,415 ms
コンパイル使用メモリ 50,884 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-18 13:54:32
合計ジャッジ時間 936 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:23: warning: ‘o’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   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