結果

問題 No.381 名声値を稼ごう Extra
ユーザー IL_mstaIL_msta
提出日時 2017-01-08 22:33:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,319 bytes
コンパイル時間 768 ms
コンパイル使用メモリ 97,952 KB
実行使用メモリ 14,168 KB
最終ジャッジ日時 2023-08-22 21:08:15
合計ジャッジ時間 1,311 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
 
#include <iostream>
#include <iomanip>
#include <sstream>
 
#include <algorithm>
#include <cmath>
 
#include <string>
#include <queue>
#include <vector>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <valarray>

#include<cassert>//assert();
//#include <random>//xAOJ
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
 
#define PII pair<int,int>
/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
/////////
using namespace::std;
/////////
/////////

vector<ULL> to_num(string str,const int keta){
	int len = str.length();
	vector<ULL> ans = vector<ULL>(len);
	string temp;
	ULL pow10 = 1;
	for(int i= 0;i<len;++i){
		temp = str[len-i-1];
		ans[i/keta] += stoi( temp )*pow10;
		if( (i+1)%keta != 0 ){
			pow10 *= 10;
		}else{
			pow10 = 1;
		}
	}
	return ans;
}
/*
template <class T> void view( vector<T> v){
	vector<T>::iterator itr,end;
	itr = v.begin();
	end = v.end();
	for(;itr != end;++itr){
		cout << (*itr);
	}
	cout << endl;
}*/
class vnum{
public:
	vector<ULL> num;
	int len;
	int ketaMax;
	ULL powMax;
	void set(string str){
		ketaMax = 17;
		powMax = 1;

		num = to_num(str,ketaMax);
		len = numLen();
		
		for(int i=1;i<ketaMax;++i){
			powMax *= 10;
		}
	}
	int numLen(){
		int Max = num.size();
		int i;
		for(i= Max-1;i>=0;--i){
			if( num[i] != 0){
				break;
			}
		}
		return i+1;
	}
	bool mod2(){//%2
		bool ans = false;
		if( num[0] % 2 ){
			ans = true;
		}
		num[0] = num[0] / 2;
		ULL temp;
		for(int i = 1; i< len;++i){
			temp = num[i]*10;
			temp /= 2;
			num[i] = temp/10;
			num[i-1] += (temp%10)*powMax;
		}
		len = numLen();
		return ans;
	}
	void view(){
		for(int i=len-1;i>=0;--i){
			cout << num[i];
		}cout << endl;
	}
};

void solve(){
	string str;
	cin >> str;
	vnum Num;
	Num.num.reserve(100000);
	Num.set(str);
	ULL count = 0;
	ULL test = 0;
	
	while(Num.len != 0){
		test++;
		if( Num.mod2() ){
			++count;
		}
		//Num.view();
		  if( test > 100)break;//
		//if( test > 10000)break;//TLE
	}
	cout << count%((ULL)1004535809) << endl;
}

int main(void){
    std::cin.tie(0); 
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed;//
    //cout << setprecision(16);//
	
	solve();
	
	return 0;
}
0