编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#6527 #1081. Luke's Game Time Limit Exceeded 60 4383 ms 456 K C++ 17 / 924 B TeddyDUDU 2024-11-16 16:03:42
显示原始代码
// D
#include <bits/stdc++.h>
using namespace std;
#define int long long

#define endl '\n'

#define fir first

#define sec second


signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    int ans = 0;
    for (int i = 2; i < n; i += 2) {
        int k = log2(i);
        int d = (1 << (k + 1)) - i;
        for (int j = 1; j * j <= i; j++) {
            if (i % j == 0) {
                int t1 = j, t2 = i / j;
                if (i + t1 <= n && t1 < d) {
                    if (gcd(i, i + t1) == (i ^ (i + t1))) {
                        ans++;
                    }
                }
                if (i + t2 <= n && t2 < d && t1 != t2) {
                    if (gcd(i, i + t2) == (i ^ (i + t2))) {
                        ans++;
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}
子任务 #1
Time Limit Exceeded
得分:60
测试点 #1
Accepted
得分:100
用时:3 ms
内存:276 KiB

输入文件(gcd0.in

268

答案文件(gcd0.out

385

用户输出

385

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:4 ms
内存:376 KiB

输入文件(gcd1.in

297

答案文件(gcd1.out

426

用户输出

426

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:3 ms
内存:396 KiB

输入文件(gcd2.in

327

答案文件(gcd2.out

470

用户输出

470

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:84 ms
内存:456 KiB

输入文件(gcd3.in

99201

答案文件(gcd3.out

172054

用户输出

172054

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:57 ms
内存:300 KiB

输入文件(gcd4.in

74945

答案文件(gcd4.out

129824

用户输出

129824

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:79 ms
内存:356 KiB

输入文件(gcd5.in

96723

答案文件(gcd5.out

167627

用户输出

167627

系统信息

Exited with return code 0
测试点 #7
Time Limit Exceeded
得分:0
用时:1033 ms
内存:404 KiB

输入文件(gcd6.in

5000000

答案文件(gcd6.out

8723182
测试点 #8
Time Limit Exceeded
得分:0
用时:1046 ms
内存:276 KiB

输入文件(gcd7.in

6000000

答案文件(gcd7.out

10467026
测试点 #9
Time Limit Exceeded
得分:0
用时:1034 ms
内存:272 KiB

输入文件(gcd8.in

8000000

答案文件(gcd8.out

13956088
测试点 #10
Time Limit Exceeded
得分:0
用时:1040 ms
内存:308 KiB

输入文件(gcd9.in

10000000

答案文件(gcd9.out

17440305