結果
| 問題 |
No.3296 81-like number
|
| コンテスト | |
| ユーザー |
hatsuka_iwa
|
| 提出日時 | 2025-10-05 14:25:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 492 bytes |
| コンパイル時間 | 1,853 ms |
| コンパイル使用メモリ | 196,024 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-10-05 14:25:57 |
| 合計ジャッジ時間 | 2,526 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
long long N, Ans = 0; cin >> N;
vector<bool> Eratosthenes(100000, true);
for (int i = 2; i < 100000; i++) {
if (!Eratosthenes.at(i)) continue;
for (int j = i * 2; j < 100000; j += i)
Eratosthenes.at(j) = false;
}
for (int i = 2; i < 100000; i++) {
if (!Eratosthenes.at(i)) continue;
long long L = (long long)i * i;
while (L <= N) {
Ans += L;
L *= i;
}
}
cout << Ans << endl;
}
hatsuka_iwa