Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <queue>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n, t, ct = 0, ct1 = 0, t1, ans = 0;
  9.     queue<int> a;
  10.     cin >> n;
  11.     cin >> t;
  12.     a.push(t);
  13.     cin >> t;
  14.     a.push(t);
  15.     cin >> t;
  16.     a.push(t);
  17.     for (int i = 3; i < n; i++)
  18.     {
  19.         cin >> t;
  20.         a.push(t);
  21.         t1 = a.front();
  22.         a.pop();
  23.         if (t1 % 23 == 0) ct++;
  24.         else ct1++;
  25.         if (t % 23 == 0) ans += ct + ct1;
  26.         else ans += ct;
  27.     }
  28.     cout << ans;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement