結果
問題 |
No.185 和風
|
ユーザー |
![]() |
提出日時 | 2023-08-03 14:22:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 1,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 1,036 ms |
コンパイル使用メモリ | 102,920 KB |
最終ジャッジ日時 | 2025-02-15 21:47:30 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<cctype> #include<set> #include<bitset> #include<math.h> #include<map> #include<queue> #include<iomanip> using namespace std; int digisum(int i){ int sum1 = 0; while (i) { sum1 += i%10; i /= 10; } return sum1; } int main(){ int n, temp = 0; cin >> n; for (int i = 0; i < n; i++){ int x, y; cin >> x >> y; if (i == 0 && (y - x) > 0) temp = y -x; else if (temp != y -x || (y - x) <= 0){ cout << -1 << endl; return 0; } } cout << temp << endl; }