結果
問題 | No.1514 Squared Matching |
ユーザー |
![]() |
提出日時 | 2021-09-10 22:16:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 638 ms / 4,000 ms |
コード長 | 589 bytes |
コンパイル時間 | 3,865 ms |
コンパイル使用メモリ | 229,448 KB |
実行使用メモリ | 393,928 KB |
最終ジャッジ日時 | 2024-06-12 00:44:37 |
合計ジャッジ時間 | 14,316 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; //const long nPrime = 1000000007; //const long nPrime = 998244353; typedef long long ll; int main() { long n; cin >> n; vector<long> viCheck(n+1,0); long nAns = 0; for(long i = 1; i <= n; i++){ if(viCheck[i] == 1){ continue; } long nCount = 1; for(; i*nCount*nCount <= n; nCount++){ viCheck[i*nCount*nCount] = 1; } nCount--; nAns += nCount*nCount; } cout << nAns << endl; return 0; }