結果
| 問題 | No.3296 81-like number | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-08-20 15:32:55 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 1,960 bytes | 
| コンパイル時間 | 3,852 ms | 
| コンパイル使用メモリ | 255,832 KB | 
| 実行使用メモリ | 7,720 KB | 
| 最終ジャッジ日時 | 2025-08-20 15:33:01 | 
| 合計ジャッジ時間 | 5,177 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
typedef long long int ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n) for(ll i=0;i<signed(n);i++)
#define EREP(i,n) for(ll i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace atcoder;
using namespace std;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X <<":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll INF = 9e18;
typedef std::pair<ll, ll> P;
struct edge { ll to, cost; };
#define VMAX 100000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
ll ans=0;
bool F=false;
// Nafmo template 2022.09.04
// Generated by 2.12.0 https://github.com/kyuridenamida/atcoder-tools
template <typename T>
struct PrimeSieve {
  int n, half;
  std::vector<bool> sieve;
  std::vector<T> prime_list;
  // sieve[i] ... 2 * i + 1
  PrimeSieve(T _n) : n(_n) {
    init();
  }
  void init() {
    if (n < 2) {
      return;
    }
    half = (n + 1) / 2;
    sieve.assign(half, true);
    sieve[0] = false;
    prime_list.emplace_back(2);
    for (long long i = 1; 2 * i + 1 <= n; ++i) {
      if (!sieve[i]) continue;
      T p = 2 * i + 1;
      prime_list.emplace_back(p);
      for (long long j = 2 * i * (i + 1); j < half; j += p) {
        sieve[j] = false;
      }
    }
  }
  bool isPrime(T x) {
    if (x == 2) return true;
    if (x % 2 == 0) return false;
    return sieve[x / 2];
  }
  T getPrimeCount() {
    return prime_list.size();
  }
  T getKthPrime(int k) {
    return prime_list[k];
  }
};
int main(){
  ll N;
  cin >> N;
  PrimeSieve<ll> ps(100000);
  for(auto x: ps.prime_list){
    ll x2 = x * x;
    while(x2 <= N){
      ans += x2;
      x2 *= x;
    }
  }
  cout << ans << endl;
  return 0;
}
            
            
            
        