mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 15:18:46 +00:00
P1590 失踪的7
R58057674
This commit is contained in:
parent
5e8c50f621
commit
86539a48c3
@ -1,29 +1,17 @@
|
||||
// 70' Code (R38866815)
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool find(int s, int x) {
|
||||
while (s) {
|
||||
if (s % 10 == x) {
|
||||
return true;
|
||||
}
|
||||
s /= 10;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
long long t, n, m, ans;
|
||||
|
||||
int main() {
|
||||
int t, n, ans;
|
||||
cin >> t;
|
||||
for (int i = 0; i < t; i++) {
|
||||
while (t--) {
|
||||
ans = m = 0;
|
||||
cin >> n;
|
||||
ans = 0;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (!find(i, 7)) {
|
||||
ans++;
|
||||
}
|
||||
while (n) {
|
||||
ans += (n % 10 - (n % 10 > 7)) * pow(9, m++);
|
||||
n /= 10;
|
||||
}
|
||||
cout << ans << endl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user