結果
問題 |
No.420 mod2漸化式
|
ユーザー |
![]() |
提出日時 | 2017-11-03 17:03:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 753 bytes |
コンパイル時間 | 691 ms |
コンパイル使用メモリ | 79,384 KB |
実行使用メモリ | 17,088 KB |
最終ジャッジ日時 | 2024-11-22 15:28:56 |
合計ジャッジ時間 | 54,328 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 TLE * 26 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; long long s = 0, d = 0; void dfs( long long a, int depth, int r ) { if ( a > 2147483647 ) { return; } if ( r == 0 ) { d += 30-depth+1; s += a*( static_cast<long long>( pow( 2, 30-depth+1 ) ) - 1 ); return; } dfs( a*2, depth+1, r ); dfs( a*2+1, depth+1, r-1 ); } int main() { long long x; cin >> x; dfs( 1, 0, x-1 ); cout << d << " " << s << endl; return 0; }