Submission #72239181
Source Code Expand
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, cnt;
int f[10000005];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
for(int i = 1; i * i <= 10000000; i ++)
for(int j = i + 1; j * j + i * i <= 10000000; j ++) {
f[i * i + j * j] ++;
}
cin >> n;
for(int i = 1; i <= n; i ++) if(f[i] == 1) cnt ++;
cout << cnt << '\n';
for(int i = 1; i <= n; i ++) if(f[i] == 1) cout << i << ' ';
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - 2026 |
| User | WangYueHeng |
| Language | C++23 (GCC 15.2.0) |
| Score | 300 |
| Code Size | 468 Byte |
| Status | AC |
| Exec Time | 118 ms |
| Memory | 85608 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_corner_00.txt, 02_corner_01.txt, 02_corner_02.txt, 02_corner_03.txt, 02_corner_04.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 61 ms | 81896 KiB |
| 00_sample_01.txt | AC | 59 ms | 81732 KiB |
| 00_sample_02.txt | AC | 58 ms | 81708 KiB |
| 01_random_00.txt | AC | 84 ms | 81888 KiB |
| 01_random_01.txt | AC | 107 ms | 84888 KiB |
| 01_random_02.txt | AC | 81 ms | 81864 KiB |
| 01_random_03.txt | AC | 108 ms | 85020 KiB |
| 01_random_04.txt | AC | 75 ms | 81868 KiB |
| 01_random_05.txt | AC | 88 ms | 82164 KiB |
| 01_random_06.txt | AC | 81 ms | 81864 KiB |
| 01_random_07.txt | AC | 80 ms | 81868 KiB |
| 01_random_08.txt | AC | 86 ms | 82032 KiB |
| 01_random_09.txt | AC | 116 ms | 85408 KiB |
| 02_corner_00.txt | AC | 61 ms | 81868 KiB |
| 02_corner_01.txt | AC | 117 ms | 85608 KiB |
| 02_corner_02.txt | AC | 118 ms | 85432 KiB |
| 02_corner_03.txt | AC | 114 ms | 85580 KiB |
| 02_corner_04.txt | AC | 115 ms | 85532 KiB |