結果

問題 No.420 mod2漸化式
ユーザー ryofjt
提出日時 2016-09-15 22:38:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 520 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 34,020 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 13:00:53
合計ジャッジ時間 1,630 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef long long ll;

int x;
ll c[32][32];
ll s[32][32];

int main(){
	scanf("%d", &x);
	
	if(x > 31){
		puts("0 0");
		return 0;
	}

	c[0][0] = 1;
	for(int i = 1; i <= 31; ++i){
		c[i][0] = 1;
		for(int j = 1; j <= i; ++j){
			c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
			s[i][j] = s[i - 1][j] + s[i - 1][j - 1] + (1 << i - 1) * c[i - 1][j - 1];
		}
	}
	printf("%lld %lld\n", c[31][x], s[31][x]);
	return 0;
}
0