結果

問題 No.420 mod2漸化式
コンテスト
ユーザー tatt61880
提出日時 2021-04-04 11:00:42
言語 Kuin
(KuinC++ v.2021.9.17)
コンパイル:
kuinc -i _filename_ -o out.cpp -s /kuin/sys/ -e cpp -r -q
実行:
./a.out
結果
WA  
実行時間 -
コード長 527 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,436 ms
コンパイル使用メモリ 164,448 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-05 17:29:38
合計ジャッジ時間 2,937 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 31 RE * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
out.cpp:676:14: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'std::shared_ptr<Array_<long>>' [-Wnontrivial-memcall]
  676 |                         memset(r->B, 0, sizeof(T) * static_cast<std::size_t>(h + bufLen_<T>()));
      |                                   ^
out.cpp:688:9: note: in instantiation of function template specialization 'newArraysRec_<std::shared_ptr<Array_<std::shared_ptr<Array_<long>>>>>::operator()<long long>' requested here
  688 |         return newArraysRec_<T>()(std::forward<A>(a)...);
      |                ^
out.cpp:1613:11: note: in instantiation of function template specialization 'newArrays_<std::shared_ptr<Array_<std::shared_ptr<Array_<long>>>>, long long>' requested here
 1613 | (k_am) = (newArrays_<type_(Array_<type_(Array_<int64_t>)>)>((32LL)));
      |           ^
out.cpp:676:14: note: explicitly cast the pointer to silence this warning
  676 |                         memset(r->B, 0, sizeof(T) * static_cast<std::size_t>(h + bufLen_<T>()));
      |                                   ^
      |                                (void*)
1 warning generated.

ソースコード

diff #
raw source code

func main()
	const nMax: int :: 31
	const valueMax: int :: lib@intMax / 2
	var comb: [][]int :: #[nMax + 1][]int
	do comb[0] :: [1]
	for n(1, nMax)
		do comb[n] :: #[n + 1]int
		do comb[n][0] :: 1
		do comb[n][n] :: 1
		for r(1, n - 1)
			do comb[n][r] :: comb[n - 1][r - 1] + comb[n - 1][r]
			if(comb[n][r] > valueMax)
				do comb[n][r] :: valueMax
			end if
		end for
	end for
	
	var n: int :: cui@inputInt()
	var ans: int :: comb[31][n]
	var sum: int :: (2 ^ 31 - 1) * comb[30][4]
	do cui@print("\{ans} \{sum}\n")
end func
0