QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#233112#7658. German Conference for Public CountingValenciaTravis#RE 0ms0kbC++20448b2023-10-31 13:32:192023-10-31 13:32:19

Judging History

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

  • [2023-10-31 13:32:19]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-10-31 13:32:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n, len;
int main(){
    cin>>n;
    if(n < 10) return printf("%d\n", n+1);
    ll tmp = n;
    while(tmp) len++, tmp /= 10;
    ll ans = (len-1) * 10;
    tmp = n;
    while(tmp >= 10) tmp /= 10;
    ans += tmp-1;
    ll tmp1 = 0;
    for(int i=1;i<=len;i++){
        tmp1 = tmp + tmp1 * 10;
    }
    if(tmp1 <= n) ans++;
    cout<<ans<<endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

5

output:

6

result: