Files
python/TangDou/XiTi/1277.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

43 lines
839 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
//输入+输出重定向
freopen("../1277.txt", "r", stdin);
int n;
cin >> n;
long long a, b;
//1位数0-9
//2位数10-99
//3位数, 100-999
//n位数 pow(10,n-1) ---> pow(10,n)-1
n == 1 ? a = 0 : a = (ll) (pow(10, n - 1));
b = (ll) (pow(10, n) - 1);
int count = 0;
for (ll i = a; i <= b; i++) {
//数位分离
ll temp = i;
int c = 0;
while (temp) {
ll ct = temp % 10;
if (ct == 3) c++;
temp /= 10;
}
if (c % 2 == 0) {
count++;
count %= 12345;
}
}
cout << count << endl;
//关闭文件
fclose(stdin);
return 0;
}