QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#244923#7658. German Conference for Public CountingPetroTarnavskyi#WA 1ms3452kbC++20786b2023-11-09 17:01:482023-11-09 17:01:48

Judging History

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

  • [2023-11-09 17:01:48]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3452kb
  • [2023-11-09 17:01:48]
  • 提交

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'