Submission

Status:

-P-P---P--

Subtask/Task Score:

30/100

Score: 30

User: thitit

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-06 10:06:28

#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 = two + i;
        }

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

    cout << two + three - mix;


}