Cod sursa(job #1895741)
| Utilizator | Data | 28 februarie 2017 10:36:27 | |
|---|---|---|---|
| Problema | Divk | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <bits/stdc++.h>
using namespace std;
int n, a, b, k;
int v[ 500000 ];
long long sol;
int main()
{
ifstream cin("divk.in");
ofstream cout("divk.out");
cin >> n >> k >> a >> b;
for (int i = 0; i < n; i++)
cin >> v[ i ];
for (int i = 0; i < n - 1; i++){
int s = v[ i ];
for (int j = i + 1; j < n; j++){
s += v[ j ];
if (s % k == 0)
sol++;
}
}
cout << sol - 1;
}
