QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#391137 | #3792. 搞笑版费马大定理 | 秦始皇派蒙恬还原神舟十二 (Jiancong Wen, Chu Jin, Zekai Zhang) | 100 ✓ | 6ms | 3588kb | C++17 | 897b | 2024-04-16 13:59:27 | 2024-04-16 13:59:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1e9 + 7;
const int N = 1e5 + 5;
void niko()
{
int x, y;
int tot = 0;
while (cin >> x >> y)
{
cout << "Case " << ++tot << ": ";
int ans = 0;
int maxn = min((int)1e3, y);
for (int i = x; i <= maxn; i++)
{
for (int j = x; j <= maxn; j++)
{
int op = i * i * i + j * j * j;
if (op % 10 == 3)
{
int c = (op - 3) / 10;
if (c <= y && c >= x)
{
ans++;
}
}
}
}
cout << ans << '\n';
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while (t--)
{
niko();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 6ms
memory: 3588kb
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