QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#234014#5038. CityCSU2023#WA 1ms3424kbC++14543b2023-11-01 12:56:322023-11-01 12:56:33

Judging History

你现在查看的是最新测评结果

  • [2023-11-01 12:56:33]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3424kb
  • [2023-11-01 12:56:32]
  • 提交

answer

#include <bits/stdc++.h>

using std::ios;
using std::cin;
using std::cout;
typedef long long ll;
int n, m; ll ans = 0;

int main()
{   
    cin >> n >> m;
    ll ans = 0;
    for (int i = 2; i <= n; ++i)
        for (int j = 2; j <= m; ++j)
            if (std::__gcd(i, j) != 1)
                ans += 2ll * (n + 1 - i) * (m + 1 - j);
    for (int i = 2; i <= n; i += 2)
        ans += 1ll * (m + 1) * (n + 1 - i);
    for (int j = 2; j <= m; j += 2)
        ans += 1ll * (n + 1) * (m + 1 - j);
    cout << ans << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3348kb

input:

1 1

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3424kb

input:

2 3

output:

14

result:

ok 1 number(s): "14"

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3256kb

input:

252 139

output:

242491316

result:

wrong answer 1st numbers differ - expected: '156806790', found: '242491316'