QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#912723#3792. 搞笑版费马大定理Horcruxs#100 ✓5ms3584kbC++14689b2025-02-23 20:31:172025-02-23 20:31:18

Judging History

This is the latest submission verdict.

  • [2025-02-23 20:31:18]
  • Judged
  • Verdict: 100
  • Time: 5ms
  • Memory: 3584kb
  • [2025-02-23 20:31:17]
  • Submitted

answer

#include <bits/stdc++.h>
#define int long long

using namespace std;

int x, y, cnt;
void solve() {
    if(x > y) {
        std::swap(x, y);
    }

    int ans = 0;
    for(int i = x; i <= std::min(y, 1000ll); i++) {
        for(int j = x; j <= std::min(y, 1000ll); j++) {
            int num = i * i * i + j * j * j;
            if(num % 10 == 3 && num / 10 >= x && num / 10 <= y) {
                ans++;
            }
        }
    }

    std::cout << "Case " << cnt << ": " << ans << '\n';
}

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

    while(std::cin >> x >> y) {
        cnt++;
        solve();
    }

    return 0;
}

詳細信息


Pretests


Final Tests

Test #1:

score: 100
Accepted
time: 5ms
memory: 3584kb

input:

2 13
123 456789
111 9999999
1 100000000
500 100000000
700 100000000
750 100000000
780 98765432
788 98421754
788 98421753

output:

Case 1: 2
Case 2: 16
Case 3: 9998
Case 4: 88224
Case 5: 14440
Case 6: 1650
Case 7: 370
Case 8: 26
Case 9: 2
Case 10: 0

result:

ok 10 lines