結果

問題 No.1687 What the Heck?
ユーザー Nzt3
提出日時 2022-09-28 18:44:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 270 bytes
コンパイル時間 2,134 ms
コンパイル使用メモリ 191,328 KB
最終ジャッジ日時 2025-02-07 18:00:52
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long N;
  cin>>N;
  long long ans=N*(N+1)/2;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    if(a==N)ans-=(i+1)*2;
  }
  cout<<max(ans,0ll)<<'\n';
  
}
0