結果

問題 No.1022 Power Equation
ユーザー auauaauaua
提出日時 2020-04-10 23:19:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,124 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 167,232 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-14 05:21:58
合計ジャッジ時間 2,218 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    return gcd(b,a%b);
}
signed main(){
    ll t;cin>>t;
    while(t){
        t--;
        ll n;cin>>n;
        ll ans=0;
        vector<ll>jou(35);
        jou[1]=n;
        REP(i,2,33){
            REP(j,2,sqrt(n)+1){
                ll res=1;
                rep(k,i){
                    res*=(ll)j;
                }
                if(res<=n)jou[i]++;
                else break;
            }
        }
        ans+=n*(2*n-1);
        REP(i,1,33){
            REP(j,i+1,33){
                ll lcm=(ll)i*(ll)j/gcd(i,j);
                ans+=n/(j/gcd(i,j))*jou[j]*2;
            }
        }
        cout<<ans<<endl;
    }
}
0