QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#508730#7658. German Conference for Public CountingUmokWA 0ms3808kbC++20873b2024-08-07 19:40:122024-08-07 19:40:13

Judging History

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

  • [2024-08-07 19:40:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3808kb
  • [2024-08-07 19:40:12]
  • 提交

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'