結果

問題 No.269 見栄っ張りの募金活動
ユーザー 👑 CleyL
提出日時 2020-03-16 18:04:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,559 ms / 5,000 ms
コード長 367 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 64,128 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-11-28 02:57:21
合計ジャッジ時間 6,115 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
const int mod = 1000000007;
int dp[101][20001];
main(){
	int n,s,k;cin>>n>>s>>k;
	s-=((n+(n-1))/2)*((n+(n-1))/2+1)/2*k;
	dp[0][0] = 1;
	if(0>s)cout <<0<< endl;
	else{for(int i=0;n>i;i++)for(int j=0;s>=j;j++)if(dp[i][j])for(int l=0;s>=j+l*(n-i);l++)dp[i+1][j+l*(n-i)]=(dp[i+1][j+l*(n-i)]+dp[i][j])%mod;cout <<dp[n][s]<< endl;}
}
0