Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: thitit

Problemset: ผลรวมตัวเลข

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-06 10:01:22

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int n;
    int m;
    int two = 0;
    int three = 0;
    int mix = 0;
    cin >> n >> m;
    for (int i = n; i <= m; i++) {
        if (i % 2 == 0) {
            two++;
        }

        if (i % 3 == 0) {
            three++;
        }
        if (i % 6 == 0) {
            mix++;
        }
        
    }

    cout << two + three - mix;


}