結果
| 問題 | No.420 mod2漸化式 |
| コンテスト | |
| ユーザー |
tetsuzuki1115
|
| 提出日時 | 2017-11-03 17:03:33 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 753 bytes |
| 記録 | |
| コンパイル時間 | 453 ms |
| コンパイル使用メモリ | 99,296 KB |
| 実行使用メモリ | 9,876 KB |
| 最終ジャッジ日時 | 2026-09-28 05:32:25 |
| 合計ジャッジ時間 | 23,120 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 TLE * 7 -- * 18 |
ソースコード
#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;
}
tetsuzuki1115