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