QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#233112 | #7658. German Conference for Public Counting | ValenciaTravis# | RE | 0ms | 0kb | C++20 | 448b | 2023-10-31 13:32:19 | 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