Submission #74778757


Source Code Expand

Copy
#include <stdio.h>
int cnt[11234567];
int main(void) {
int N;
int x, y;
int i, k = 0, first = 1;
if (scanf("%d", &N) != 1) return 1;
for (x = 1; x * x <= N; x++) {
for (y = x + 1; x * x + y * y <= N; y++) {
cnt[x * x + y * y]++;
}
}
for (i = 1; i <= N; i++) {
if (cnt[i] == 1) k++;
}
printf("%d\n", k);
for (i = 1; i <= N; i++) {
if (cnt[i] == 1) {
printf(" %d" + first, i);
first = 0;
}
}
putchar('\n');
return 0;
}
/*
Numbers that are the sum of 2 distinct nonzero squares in exactly 1 way.
https://oeis.org/A025302
*/
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <stdio.h>

int cnt[11234567];

int main(void) {
	int N;
	int x, y;
	int i, k = 0, first = 1;
	if (scanf("%d", &N) != 1) return 1;
	for (x = 1; x * x <= N; x++) {
		for (y = x + 1; x * x + y * y <= N; y++) {
			cnt[x * x + y * y]++;
		}
	}
	for (i = 1; i <= N; i++) {
		if (cnt[i] == 1) k++;
	}
	printf("%d\n", k);
	for (i = 1; i <= N; i++) {
		if (cnt[i] == 1) {
			printf(" %d" + first, i);
			first = 0;
		}
	}
	putchar('\n');
	return 0;
}

/*

Numbers that are the sum of 2 distinct nonzero squares in exactly 1 way.
https://oeis.org/A025302

→ いっぱいある あまり役に立たなそう

*/

Submission Info

Submission Time
Task C - 2026
User mikecat
Language C23 (GCC 14.2.0)
Score 300
Code Size 649 Byte
Status AC
Exec Time 97 ms
Memory 46292 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 18
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 1 ms 1632 KiB
00_sample_01.txt AC 0 ms 1648 KiB
00_sample_02.txt AC 0 ms 1620 KiB
01_random_00.txt AC 40 ms 19760 KiB
01_random_01.txt AC 84 ms 41056 KiB
01_random_02.txt AC 38 ms 19388 KiB
01_random_03.txt AC 88 ms 42848 KiB
01_random_04.txt AC 24 ms 12164 KiB
01_random_05.txt AC 46 ms 23364 KiB
01_random_06.txt AC 30 ms 15756 KiB
01_random_07.txt AC 27 ms 14268 KiB
01_random_08.txt AC 45 ms 22192 KiB
01_random_09.txt AC 94 ms 44852 KiB
02_corner_00.txt AC 1 ms 1616 KiB
02_corner_01.txt AC 97 ms 46280 KiB
02_corner_02.txt AC 97 ms 46292 KiB
02_corner_03.txt AC 96 ms 46156 KiB
02_corner_04.txt AC 94 ms 46236 KiB


2026-04-09 (Thu)
07:26:16 +09:00