QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#60734#5006. HeximalJesTL 2ms3520kbC++171.2kb2022-11-06 21:57:392022-11-06 21:57:42

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-06 21:57:42]
  • 评测
  • 测评结果:TL
  • 用时:2ms
  • 内存:3520kb
  • [2022-11-06 21:57:39]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

#define int long long
#define ll long long
#define fi first
#define se second
#define no "NO\n"
#define yes "YES\n"
#define pb push_back
#define endl "\n"
#define dbg(x...) do{cout<<#x<<" -> ";err(x);}while (0)

void err() { cout << '\n'; }

template<class T, class... Ts>
void err(T arg, Ts... args) {
    cout << arg << ' ';
    err(args...);
}

string d(string dividend,int divisor){
	string result;
	int shang,remainder=0;
	for(int i=0;i<dividend.size();i++){
		shang=(remainder*10+(dividend[i]-'0'))/divisor;
		remainder=(remainder*10+dividend[i]-'0')%divisor;
		result.push_back(char(shang+'0'));
	}
	while(1){
		if(result[0]=='0')
			result.erase(result.begin(),result.begin()+1);
		if(result[0]!='0') break;
	}
	return result;
}

const int N = 2e5+7;

void solve(){
	string s;
	cin >> s;
	ll cnt=1;
	while(1){
		if(s.size() == 1){
			int x =stoi(s);
			if(x>=6) cnt++;
			break;	
		} 
		s = d(s,6);
		cnt++;
	
	}
	cout << cnt ;
}
signed main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin.tie(nullptr),cout.tie(nullptr);
    int T=1;
 
    //cin >> T;
    while(T--) solve();

    return 0 ;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3516kb

input:

0

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3316kb

input:

1865

output:

5

result:

ok single line: '5'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

6

output:

2

result:

ok single line: '2'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3300kb

input:

5

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3516kb

input:

216

output:

4

result:

ok single line: '4'

Test #6:

score: -100
Time Limit Exceeded

input:

659048550435237232393875796171343597297252783860791224966151609834498375660891507785647188078990198766575546966667938541517709208360385263203130845215396367798902376853652489767206051858708602045962531467486884777174160264291462611744982439094276291073422016146183934443085743192727084631329374278797...

output:


result: