結果
問題 |
No.420 mod2漸化式
|
ユーザー |
|
提出日時 | 2016-11-18 21:39:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 676 bytes |
コンパイル時間 | 387 ms |
コンパイル使用メモリ | 53,160 KB |
実行使用メモリ | 16,848 KB |
最終ジャッジ日時 | 2024-11-26 06:14:59 |
合計ジャッジ時間 | 48,332 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 TLE * 23 |
ソースコード
#include "iostream" using namespace std; const long long int UP = 2147483647; //int log_num[32] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,} int N; long long int ans; int fig; void search(long long int num,int point) { if (num > UP)return ; if (num == 0) { search(1, 1); if (N == 0) { fig++; } return ; } if (point < N) { search(num * 2, point); search(num * 2 + 1, point + 1); } else if (point == N) { ans += num; fig++; search(num * 2, point); } return ; } int main() { cin >> N; search(0, 0); cout << fig << " " << ans << "\n"; return 0; }