結果

問題 No.1687 What the Heck?
ユーザー zezero
提出日時 2021-09-24 21:46:28
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 924 ms
コンパイル使用メモリ 93,984 KB
最終ジャッジ日時 2025-01-24 17:03:27
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <queue>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    if (n == 1){
        cout << 0 << endl;
        return 0;
    }
    rep(i,n){
        ll x;
        cin >> x;
        if (x == n){
            ans -= (i+1);
        }
        else{
            ans += (i+1);
        }
    }
    cout << ans << endl;

    return 0;
}
0