結果

問題 No.420 mod2漸化式
コンテスト
ユーザー MADONO
提出日時 2016-09-09 22:54:19
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
RE  
実行時間 -
コード長 1,095 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 797 ms
コンパイル使用メモリ 102,380 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-11 17:14:35
合計ジャッジ時間 1,858 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// g++ temp.cpp
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <string>
#include <climits>
using namespace std;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
//#define REP(i,n) FOR(i,1,n)
#define EACH(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
const unsigned long long MOD = 100000000000000000;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 2147483647
ll d[MAX_N];
ll f(ll n){
  if(d[n]!=0){
    return d[n];
  }
  if(n==0){
    return 0;
  } else {
    return d[n]=f(n/2)+n%2;
  }
}

void solve(){
  ll x;
  cin>>x;
  ll ans=0,cur=0;
   for(int i=0;i<2147483647;i++){
    if(f(i)==x){
      ans+=i;
      cur++;
    }
   }
   cout<<cur<<" "<<ans<<endl;
}
int main(){
  solve();
  return 0;
}
0