QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#508730 | #7658. German Conference for Public Counting | Umok | WA | 0ms | 3808kb | C++20 | 873b | 2024-08-07 19:40:12 | 2024-08-07 19:40:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define int long long
#define uint unsigned long long
#define lb(x) (x & (-x))
#define endl '\n'
#define INF LONG_LONG_MAX
#define eps 1e-7
const int N = 2e5 + 5;
typedef pair<int, int> PII;
void solve()
{
int n, x;
cin >> n;
x = n;
vector<int> v;
while (x)
{
v.push_back(x % 10);
x /= 10;
}
reverse(v.begin(), v.end());
int ans = 0;
int len = v.size();
if (len == 1)
{
cout << v[0] + 1 << endl;
return;
}
else
{
ans += (len - 1) * 10;
if (v[0] >= v[1])
ans += v[0] - 1;
else
ans += v[0];
cout << ans << endl;
}
}
signed main()
{
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3532kb
input:
5
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
20
output:
11
result:
ok single line: '11'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3464kb
input:
44
output:
13
result:
wrong answer 1st lines differ - expected: '14', found: '13'