結果

問題 No.1514 Squared Matching
ユーザー poyo_starpoyo_star
提出日時 2021-05-21 23:04:51
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,101 ms / 4,000 ms
コード長 410 bytes
コンパイル時間 2,287 ms
コンパイル使用メモリ 195,048 KB
実行使用メモリ 198,956 KB
最終ジャッジ日時 2024-04-18 16:38:56
合計ジャッジ時間 21,484 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1,101 ms
198,864 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 17 ms
6,940 KB
testcase_07 AC 202 ms
40,816 KB
testcase_08 AC 1,048 ms
191,764 KB
testcase_09 AC 910 ms
168,088 KB
testcase_10 AC 984 ms
181,724 KB
testcase_11 AC 1,038 ms
189,288 KB
testcase_12 AC 1,077 ms
194,356 KB
testcase_13 AC 1,063 ms
196,964 KB
testcase_14 AC 1,090 ms
197,964 KB
testcase_15 AC 1,079 ms
198,480 KB
testcase_16 AC 1,087 ms
198,824 KB
testcase_17 AC 1,093 ms
198,824 KB
testcase_18 AC 1,098 ms
198,940 KB
testcase_19 AC 1,089 ms
198,892 KB
testcase_20 AC 1,087 ms
198,956 KB
testcase_21 AC 1,092 ms
198,808 KB
testcase_22 AC 217 ms
42,704 KB
testcase_23 AC 428 ms
81,668 KB
testcase_24 AC 652 ms
120,844 KB
testcase_25 AC 874 ms
159,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    long n;
    cin >> n;
    int a[n + 1];
    for(int i = 0; i <= n; i++) a[i] = i;
    for(int i = 2; i <= sqrt(n); i++){
        for(int j = i * i; j <= n; j += i * i){
            while(a[j] % (i * i) == 0) a[j] /= i * i;
        }
    }
    long k = 0;
    for(int i = 1; i <= n; i++){
        k += sqrt(n / a[i]);
    }
    cout << k << endl;
}
0