QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#508755 | #7658. German Conference for Public Counting | cloudsss | WA | 0ms | 3640kb | C++20 | 907b | 2024-08-07 19:54:37 | 2024-08-07 19:54:38 |
Judging History
answer
#include<bits/stdc++.h>
#define INF 100100
#define maxx 100000007
#define pi 3.14159265359
using namespace std;
typedef long long LL;
int weishu(int x)
{
int cnt=0;
while(x)
{
cnt++;
x/=10;
}
return cnt;
}
int shu[11];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int wei=weishu(n);
int ans=0;
ans+=(wei-1)*10;
int temp=n;
int cnt=1;
while(temp)
{
shu[cnt++]=temp%10;
temp/=10;
}
int a=shu[cnt-1];
int cnth=0;
for(int i=1;i<cnt;i++)
{
if(shu[i]>=a)
cnth++;
}
bool flag=1;
if(cnth<=wei)
flag=0;
if(wei>1)
{
if(flag)
ans+=a;
else
ans+=a-1;
}
else
ans+=a+1;
cout<<ans;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
input:
5
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
20
output:
11
result:
ok single line: '11'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3552kb
input:
44
output:
13
result:
wrong answer 1st lines differ - expected: '14', found: '13'