結果
| 問題 |
No.1514 Squared Matching
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-21 21:44:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 554 ms / 4,000 ms |
| コード長 | 364 bytes |
| コンパイル時間 | 566 ms |
| コンパイル使用メモリ | 68,820 KB |
| 実行使用メモリ | 394,156 KB |
| 最終ジャッジ日時 | 2024-10-10 08:17:09 |
| 合計ジャッジ時間 | 13,248 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main()
| ^~~~
ソースコード
#include<iostream>
#include<map>
using namespace std;
int N;
const int LIM=5e7;
int isp[LIM+1];
int mp[LIM+1];
main()
{
for(int i=2;i*i<=LIM;i++)
{
for(int j=i*i;j<=LIM;j+=i*i)isp[j]=i*i;
}
cin>>N;
for(int i=1;i<=N;i++)
{
int t=i;
while(isp[t]>0)t/=isp[t];
mp[t]++;
}
long ans=0;
for(int i=1;i<=LIM;i++)ans+=(long)mp[i]*mp[i];
cout<<ans<<endl;
}