提出 #72182081


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"
const ll N=1e7;
ll f[N+2];
vector<ll>all;
signed main()
{
    ios::sync_with_stdio(0),cin.tie(0);
    for(ll x=1; x*x<=N; x++)
    {
        for(ll y=x+1; x*x + y*y<=N; y++)
        {
            f[x*x+y*y]++;
        }
    }
    for(ll i=1; i<=N; i++)if(f[i]==1)all.emplace_back(i);

    int Tc=0,Tests=1;
////    cin>>Tests;
    while(Tc++<Tests)
    {
        ll k,c=0;
        cin>>k;

        for(auto x:all)
        {
            if(x<=k)c++;
            else break;

        }
        cout<<c<<endl;

        for(auto x:all)
        {
            if(x<=k)cout<<x<<" ";
            else break;
        }


    }///End TotalTests
}   ///End Main

提出情報

提出日時
問題 C - 2026
ユーザ Dark_543
言語 C++23 (GCC 15.2.0)
得点 300
コード長 781 Byte
結果 AC
実行時間 124 ms
メモリ 92444 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 18
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 85 ms 89708 KiB
00_sample_01.txt AC 82 ms 89896 KiB
00_sample_02.txt AC 79 ms 89768 KiB
01_random_00.txt AC 101 ms 89716 KiB
01_random_01.txt AC 119 ms 91732 KiB
01_random_02.txt AC 103 ms 89840 KiB
01_random_03.txt AC 122 ms 91968 KiB
01_random_04.txt AC 94 ms 89896 KiB
01_random_05.txt AC 103 ms 89724 KiB
01_random_06.txt AC 98 ms 89736 KiB
01_random_07.txt AC 97 ms 89680 KiB
01_random_08.txt AC 102 ms 89620 KiB
01_random_09.txt AC 123 ms 92332 KiB
02_corner_00.txt AC 84 ms 89768 KiB
02_corner_01.txt AC 120 ms 92412 KiB
02_corner_02.txt AC 121 ms 92380 KiB
02_corner_03.txt AC 124 ms 92444 KiB
02_corner_04.txt AC 122 ms 92444 KiB