結果
問題 | No.287 場合の数 |
ユーザー |
|
提出日時 | 2015-10-09 20:26:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 577 bytes |
コンパイル時間 | 809 ms |
コンパイル使用メモリ | 54,748 KB |
実行使用メモリ | 7,168 KB |
最終ジャッジ日時 | 2024-11-07 23:47:07 |
合計ジャッジ時間 | 1,434 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <iostream>using namespace std;typedef long long ll;ll C[700][700];int main(){for(int n=0;n<700;n++){for(int k=0;k<=n;k++){if(k == 0 || k == n){C[n][k] = 1;} else {C[n][k] = C[n-1][k-1] + C[n-1][k];}}}int n;cin >> n;ll res = 0;for(int m=0;m<1<<8;m++){int tot = 6 * n;int cnt = 0;for(int i=0;i<8;i++){if((m >> i) & 1){tot -= n + 1;++cnt;}}if(tot < 0){continue;}if(cnt % 2 == 0){res += C[tot+7][7];} else {res -= C[tot+7][7];}}cout << res << endl;return 0;}