QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#244923 | #7658. German Conference for Public Counting | PetroTarnavskyi# | WA | 1ms | 3452kb | C++20 | 786b | 2023-11-09 17:01:48 | 2023-11-09 17:01:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); i--)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(15);
int n;
cin >> n;
int len = 0;
LL pw = 1;
while(pw <= n)
{
len++;
pw *= 10;
}
pw /= 10;
int x = (n / pw);
int ans = 10 * (len - 1) + x - 1;
if((10 * pw - 1) * x / 9 <= n)
ans++;
cout << ans << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3452kb
input:
5
output:
5
result:
wrong answer 1st lines differ - expected: '6', found: '5'