結果

問題 No.555 世界史のレポート
ユーザー vjudge1
提出日時 2025-05-21 16:54:16
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 361 bytes
コンパイル時間 3,250 ms
コンパイル使用メモリ 273,868 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-05-21 16:54:20
合計ジャッジ時間 4,280 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         freopen("ctrlcv.in","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
main.cpp:7:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         freopen("ctrlcv.out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int n,c,v,ans=0x3f3f3f3f,dp[100005];
int main()
{
	freopen("ctrlcv.in","r",stdin);
	freopen("ctrlcv.out","w",stdout);
	cin>>n>>c>>v;n<<=1;
	memset(dp,0x3f,sizeof(dp));dp[1]=0;
	for(int i=1;i<=n;i++)for(int j=2;j<=n/i;j++)dp[i*j]=min(dp[i*j],dp[i]+c+v*(j-1));
	for(int i=n/2;i<=n;i++)ans=min(ans,dp[i]);
	cout<<ans;
}
0