結果
問題 |
No.375 立方体のN等分 (1)
|
ユーザー |
![]() |
提出日時 | 2016-06-04 23:18:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 455 bytes |
コンパイル時間 | 796 ms |
コンパイル使用メモリ | 78,168 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-08 09:34:18 |
合計ジャッジ時間 | 1,916 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 WA * 22 |
ソースコード
#include <iostream> #include <map> #include <algorithm> using namespace std; map<long, int> func(long n) { map<long, int> res; for(long i=2; i*i<=n; ++i) { int cnt=0; while (n%i==0) { ++cnt; n/=i; } if (cnt) res[i]+=cnt; } if (n>1) res[n]++; return res; } int main() { long n; cin>>n; auto f=func(n); int res=0; for(auto& e: f) res+=(e.first-1)*e.second; cout<<res<<' '<<n-1<<endl; }