Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- #define pb push_back
- #define X first
- #define Y second
- const ll mod = 998244353;
- using namespace std;
- ll n, k[3], ans, x;
- int main()
- {
- cin >> n;
- for(ll i = 0; i < n; i++)
- {
- cin >> x;
- if (x % 29 == 0) ans += max(0LL, i - 2);
- else ans += k[0];
- k[0] = k[1];
- k[1] = k[2];
- if (x%29 == 0) k[2]++;
- }
- cout << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement