Cod sursa(job #3277011)
| Utilizator | Data | 15 februarie 2025 11:15:31 | |
|---|---|---|---|
| Problema | Numarare | Scor | 50 |
| Compilator | cpp-64 | Status | done |
| Runda | vs11_12_vine_oji_2025 | Marime | 0.52 kb |
#include <bits/stdc++.h>
#define MOD 20173333
using namespace std;
ifstream fin("numarare.in");
ofstream fout("numarare.out");
int n;
int s[100005];
int main()
{
int i, x, y, cnt;
fin >> n;
for (i = 1; i <= n; i++)
fin >> s[i];
cnt = 0;
for (i = 1; i <= n; i++)
{
x = i - 1; y = i;
while (x >= 1 && y <= n && s[x] + s[y] == s[i - 1] + s[i])
{
cnt++;
x--; y++;
}
}
fout << cnt << "\n";
return 0;
}
