Advertisement
Josif_tepe

Untitled

Feb 23rd, 2024
823
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int m, n;
  6.     cin >> m >> n;
  7.     int zbir = 0;
  8.     for(int i = 1; i <= n; i += 1) {
  9.         int smrk = 0;
  10.         if(i % 3 == 1) {
  11.             smrk = 1;
  12.         }
  13.         else if(i % 3 == 2) {
  14.             smrk = 2;
  15.         }
  16.         else if(i % 3 == 0) {
  17.             smrk = 3;
  18.         }
  19.         if(i > m) {
  20.             zbir += smrk;
  21.         }
  22.     }
  23.     cout << zbir << endl;
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement