QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#508755#7658. German Conference for Public CountingcloudsssWA 0ms3640kbC++20907b2024-08-07 19:54:372024-08-07 19:54:38

Judging History

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

  • [2024-08-07 19:54:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3640kb
  • [2024-08-07 19:54:37]
  • 提交

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'