結果
| 問題 |
No.2053 12345...
|
| コンテスト | |
| ユーザー |
pengin_2000
|
| 提出日時 | 2022-08-21 12:56:04 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 2,000 ms |
| コード長 | 290 bytes |
| コンパイル時間 | 110 ms |
| コンパイル使用メモリ | 29,312 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-10 05:56:07 |
| 合計ジャッジ時間 | 1,741 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
#include<stdio.h>
int a[200005];
int main()
{
int n;
scanf("%d", &n);
int i;
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
long long int ans = 0, f = 0;
for (i = 1; i < n; i++)
{
if (a[i - 1] + 1 == a[i])
f++;
else
f = 0;
ans += f;
}
printf("%lld\n", ans);
return 0;
}
pengin_2000