結果

問題 No.1022 Power Equation
ユーザー ngtkanangtkana
提出日時 2020-04-10 21:58:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 1,978 ms
コンパイル使用メモリ 198,680 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-14 00:30:05
合計ジャッジ時間 2,910 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using ld=long double;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint t;std::cin>>t;
    while(t--){
        lint n;std::cin>>n;
        lint ans=0;
        lint lg=std::log2(n);
        for(lint p=1;p<=lg;p++){
        for(lint q=1;q<=lg;q++){
            if(std::gcd(p,q)!=1)continue;
            lint r=std::max(p,q);
            ans+=((lint)std::pow(n,1.0/r)-1)*n/r;
        }}
        ans+=n*n;
        std::cout<<ans<<'\n';
    }
}
0