QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#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;
}
详细
Test #1:
score: 0
Runtime Error
input:
5
output:
6