結果
| 問題 |
No.1022 Power Equation
|
| コンテスト | |
| ユーザー |
auaua
|
| 提出日時 | 2020-04-10 23:19:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,124 bytes |
| コンパイル時間 | 1,577 ms |
| コンパイル使用メモリ | 168,024 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-16 00:43:38 |
| 合計ジャッジ時間 | 2,174 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 8 |
ソースコード
#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;
}
}
auaua