結果
問題 | No.1737 One to N |
ユーザー |
![]() |
提出日時 | 2021-11-12 21:27:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 421 bytes |
コンパイル時間 | 4,272 ms |
コンパイル使用メモリ | 250,060 KB |
最終ジャッジ日時 | 2025-01-25 15:45:42 |
ジャッジサーバーID (参考情報) |
judge8 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <stdio.h>#include <bits/stdc++.h>#include <atcoder/all>using namespace atcoder;using mint = modint998244353;using namespace std;#define rep(i,n) for (int i = 0; i < (n); ++i)#define Inf 1000000001int main(){int N;cin>>N;vector<int> dp(N+1,Inf);dp[1] = 0;for(int i=1;i<=N;i++){for(int j=2;j*i<=N;j++){dp[j*i] = min(dp[j*i],dp[i]+j);}}cout<<dp.back()<<endl;return 0;}