結果

問題 No.129 お年玉(2)
ユーザー fiord
提出日時 2015-08-03 22:35:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 419 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 35,168 KB
実行使用メモリ 29,696 KB
最終ジャッジ日時 2024-07-18 01:09:46
合計ジャッジ時間 8,070 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 1 TLE * 1 -- * 44
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         ll n,m; scanf("%lld %lld",&n,&m);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long int ll;
const ll E=1e9;
ll dp[10000][10000];
int main(){
	ll n,m;	scanf("%lld %lld",&n,&m);
	n/=1000;
	n%=m;
	//mCnを求める
	dp[0][0]=1;
	for(int i=1;i<=max(n,m);i++){
		dp[i][0]=1;	dp[i][i]=1;
		for(int j=1;j<=i;j++){
			dp[i][j]=(dp[i-1][j]+dp[i-1][j-1])%E;
		}
	}
	if(dp[m][n]==0)	dp[m][n]++;
	printf("%lld\n",dp[m][n]);
	return 0;
}
0