結果
| 問題 |
No.2053 12345...
|
| コンテスト | |
| ユーザー |
rieaaddlreiuu
|
| 提出日時 | 2022-10-25 18:52:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 451 bytes |
| コンパイル時間 | 1,426 ms |
| コンパイル使用メモリ | 166,944 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-03 16:34:27 |
| 合計ジャッジ時間 | 3,193 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 WA * 10 |
ソースコード
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
int length = 0;
int N;
int ans = 0;
scanf("%d",&N);
int a[N];
for(int i=0;i<N;i++){
scanf("%d",&a[i]);
}
for(int i=0;i<N-1;i++){
if(a[i] +1 == a[i+1]){
length++;
} else {
ans += length*(length+1)/2;
length = 0;
}
}
ans += length*(length+1)/2;
printf("%d",ans);
}
rieaaddlreiuu