QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#494754 | #5006. Heximal | zmrzmr | WA | 4ms | 3852kb | C++14 | 950b | 2024-07-27 16:51:10 | 2024-07-27 16:51:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
string divideBy6(string q)
{
int n = q.size();
string ans;
int r = 0;
for (int i = 0; i < n; ++i)
{
int cd = q[i] - '0';
int de = r * 10 + cd;
int cq = de / 6;
r = de % 6;
ans += to_string(cq);
}
int i;
bool fa=false;
for(i=0; i<q.size(); i++)
{
if(q[i]!='0')
{
fa=true;
break;
}
}
if(fa)return ans.substr(i);
else return "0";
}
int main()
{
char ch;
double re=0,s=0;
double y;
int flag=0;
int cnt=0;
string a="";
while((scanf("%c",&ch))!=EOF)
{
s=s*10+(ch-48+y);
if(s>=6)
while(s>6)
{
double k=s/6;
y=(s-k*6)*10/6.0;
s=s/6;
re++;
}
if(cnt<=18)
{
if(isdigit(ch))a+=ch;
}
cnt++;
}
if(cnt>18)cout<<re+1<<endl;
else
{
long long cn=0;
if(a=="0"){
cout<<1;
return 0;
}
while(a!="0")
{
cn++;
a=divideBy6(a);
}
cout<<cn;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3704kb
input:
0
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
1865
output:
5
result:
ok single line: '5'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
6
output:
2
result:
ok single line: '2'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
5
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
216
output:
4
result:
ok single line: '4'
Test #6:
score: -100
Wrong Answer
time: 4ms
memory: 3852kb
input:
659048550435237232393875796171343597297252783860791224966151609834498375660891507785647188078990198766575546966667938541517709208360385263203130845215396367798902376853652489767206051858708602045962531467486884777174160264291462611744982439094276291073422016146183934443085743192727084631329374278797...
output:
133398
result:
wrong answer 1st lines differ - expected: '123577', found: '133398'