結果

問題 No.420 mod2漸化式
ユーザー kapo
提出日時 2016-09-10 00:19:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 1,258 bytes
コンパイル時間 1,356 ms
コンパイル使用メモリ 79,424 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-11-16 19:02:59
合計ジャッジ時間 32,180 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21 TLE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

ll ans = 0;
ll sum = 0;
int x = 0;

void calc(ll s, int n, int cnt) {
	if (n == 32 && cnt < x) return;
	if (cnt == x) {
		//debug(s);
		ans++;
		sum += s;
		return;
	}
	if (32-n < x-cnt) return;
	ll a = pow(2,n);
	calc(s+a, n+1, cnt+1);
	calc(s, n+1, cnt);
}

int main()
{
	cin >> x;
	calc(0, 1, 0);

	cout << ans << " " << sum/2 << endl;

	return 0;
}
0