結果

問題 No.420 mod2漸化式
ユーザー どららどらら
提出日時 2016-09-09 23:33:42
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 3,253 bytes
コンパイル時間 1,035 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-24 11:17:11
合計ジャッジ時間 2,165 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

#define MX 2147483648LL

int main(){
  ios::sync_with_stdio(false);
  ll x;
  cin >> x;

  if(x==0) std::cout << "1 0" << std::endl;
  if(x==1) std::cout << "31 2147483647" << std::endl;
  if(x==2) std::cout << "465 64424509410" << std::endl;
  if(x==3) std::cout << "4495 934155386445" << std::endl;
  if(x==4) std::cout << "31465 8718783606820" << std::endl;
  if(x==5) std::cout << "169911 58851789346035" << std::endl;
  if(x==6) std::cout << "736281 306029304599382" << std::endl;
  if(x==7) std::cout << "2629575 1275122102497425" << std::endl;
  if(x==8) std::cout << "7888725 4371847208562600" << std::endl;
  if(x==9) std::cout << "20160075 12569060724617475" << std::endl;
  if(x==10) std::cout << "44352165 30724370660176050" << std::endl;
  if(x==11) std::cout << "84672315 64521178386369705" << std::endl;
  if(x==12) std::cout << "141120525 117311233429763100" << std::endl;
  if(x==13) std::cout << "206253075 185742786263791575" << std::endl;
  if(x==14) std::cout << "265182525 257182319442172950" << std::endl;
  if(x==15) std::cout << "300540195 312292816465495725" << std::endl;
  if(x==16) std::cout << "300540195 333112337563195440" << std::endl;
  if(x==17) std::cout << "265182525 312292816465495725" << std::endl;
  if(x==18) std::cout << "206253075 257182319442172950" << std::endl;
  if(x==19) std::cout << "141120525 185742786263791575" << std::endl;
  if(x==20) std::cout << "84672315 117311233429763100" << std::endl;
  if(x==21) std::cout << "44352165 64521178386369705" << std::endl;
  if(x==22) std::cout << "20160075 30724370660176050" << std::endl;
  if(x==23) std::cout << "7888725 12569060724617475" << std::endl;
  if(x==24) std::cout << "2629575 4371847208562600" << std::endl;
  if(x==25) std::cout << "736281 1275122102497425" << std::endl;
  if(x==26) std::cout << "169911 306029304599382" << std::endl;
  if(x==27) std::cout << "31465 58851789346035" << std::endl;
  if(x==28) std::cout << "4495 8718783606820" << std::endl;
  if(x==29) std::cout << "465 934155386445" << std::endl;
  if(x==30) std::cout << "31 64424509410" << std::endl;
  if(x==31) std::cout << "1 2147483647" << std::endl;
  if(x>=32) std::cout << "0 0" << std::endl;
  return 0;
}
int main2(){
  vector<ll> v;
  v.push_back(0);  
  
  ll now = 0;
  while(true){
    now++;
    vector<ll> w;
    rep(i,v.size()){
      if(2*v[i]+1<MX) w.push_back(2*v[i]+1);
    }
    vector<ll> ww;
    FOR(it,w){
      ll a = *it;
      while(a<MX){
        ww.push_back(a);
        a*=2;
      }
    }
    swap(v,ww);

    ll sum = 0;
    rep(i,v.size()){
      sum += v[i];
    }
    cout << "if(x==" << now << ") std::cout << \"" << v.size() << " " << sum << "\" << std::endl;" << endl;


    if(ww.size() == 0) break;
  }

  
  return 0;
}
0