結果
| 問題 | 
                            No.185 和風
                             | 
                    
| コンテスト | |
| ユーザー | 
                             cowgirl
                         | 
                    
| 提出日時 | 2018-10-07 16:20:12 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 394 bytes | 
| コンパイル時間 | 1,326 ms | 
| コンパイル使用メモリ | 166,036 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-12 14:14:12 | 
| 合計ジャッジ時間 | 1,884 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 5 WA * 2 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    int x[1010],y[1010],ans[1010]={0};
    int sum=0;
    for(int i=0; i < n; i++) cin >> x[i] >> y[i];
    for(int i=0; i < n; i++){
        if(y[i] - x[i] > 0){
            ans[i] = y[i] - x[i];
            sum += ans[i];
        }
    }
    if(sum % n == 0) cout << ans[0] << endl;
    else cout << -1 << endl;
}
            
            
            
        
            
cowgirl