結果

問題 No.1514 Squared Matching
ユーザー ytftytft
提出日時 2021-08-13 18:15:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 641 ms / 4,000 ms
コード長 497 bytes
コンパイル時間 1,644 ms
コンパイル使用メモリ 165,620 KB
実行使用メモリ 198,608 KB
最終ジャッジ日時 2024-04-14 12:32:11
合計ジャッジ時間 12,416 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 641 ms
198,580 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 9 ms
6,944 KB
testcase_07 AC 104 ms
40,500 KB
testcase_08 AC 552 ms
191,432 KB
testcase_09 AC 473 ms
167,760 KB
testcase_10 AC 512 ms
181,456 KB
testcase_11 AC 537 ms
188,928 KB
testcase_12 AC 548 ms
194,052 KB
testcase_13 AC 559 ms
196,792 KB
testcase_14 AC 560 ms
197,736 KB
testcase_15 AC 564 ms
198,284 KB
testcase_16 AC 559 ms
198,344 KB
testcase_17 AC 563 ms
198,480 KB
testcase_18 AC 562 ms
198,596 KB
testcase_19 AC 562 ms
198,608 KB
testcase_20 AC 558 ms
198,568 KB
testcase_21 AC 561 ms
198,488 KB
testcase_22 AC 109 ms
42,444 KB
testcase_23 AC 225 ms
81,372 KB
testcase_24 AC 338 ms
120,364 KB
testcase_25 AC 445 ms
159,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


int main(){
    int N;
    cin>>N;
    vector<int> squirrel(N+1,0);
    for(int i=1;i<=N;i++){
        if(squirrel[i]==0){
            int pointer=i;
            int j=1;
            while(pointer*j*j<=N){
                squirrel[pointer*j*j]=i;
                j++;
            }
        }
    }
    int ans=0;
    for(int i=1;i<=N;i++){
        int j=N/squirrel[i];
        int k=(int)sqrt((double)j);
        ans+=k;
    }
    cout<<ans<<endl;
}
0