結果
問題 | No.1022 Power Equation |
ユーザー |
![]() |
提出日時 | 2020-04-10 23:19:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 623 bytes |
コンパイル時間 | 1,509 ms |
コンパイル使用メモリ | 166,092 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 00:34:01 |
合計ジャッジ時間 | 2,264 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 8 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)#define rep(i,n) REP(i,0,n)#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)#define ALLOF(c) (c).begin(), (c).end()typedef long long ll;typedef unsigned long long ull;ll solve(ll N){ll ret = N*N + (N*N-N);ll sum = 0;for(ll a = 2; a<=sqrt(N); a++){ll x = (ll)(log(N)/log(a));ll y = (x-1) * (N/x);sum += y;}ret += 2*sum;return ret;}int main(){int T;cin >> T;while(T--){ll N;cin >> N;cout << solve(N) << endl;}return 0;}