結果
| 問題 |
No.1737 One to N
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2023-03-16 02:01:49 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 2,000 ms |
| コード長 | 375 bytes |
| コンパイル時間 | 2,711 ms |
| コンパイル使用メモリ | 244,548 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-18 09:07:09 |
| 合計ジャッジ時間 | 4,055 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int n;
cin>>n;
int inf = 1e9;
vector<int> dp(n+1,inf);
dp[1] = 0;
for(int i = 1;i<=n;i++){
for(int j = 1;j*i<=n;j++){
int ni = i * j;
if(n%ni!=0) continue;
dp[ni] = min(dp[ni],dp[i]+j);
}
}
cout<<dp[n]<<endl;
}
momoyuu