0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 15:36:27 +00:00

P1590 失踪的7

R58057674
This commit is contained in:
Baoshuo Ren 2021-09-15 18:22:51 +08:00 committed by Baoshuo Ren
parent 5e8c50f621
commit 86539a48c3
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -1,29 +1,17 @@
// 70' Code (R38866815)
#include <bits/stdc++.h> #include <bits/stdc++.h>
using namespace std; using namespace std;
bool find(int s, int x) { long long t, n, m, ans;
while (s) {
if (s % 10 == x) {
return true;
}
s /= 10;
}
return false;
}
int main() { int main() {
int t, n, ans;
cin >> t; cin >> t;
for (int i = 0; i < t; i++) { while (t--) {
ans = m = 0;
cin >> n; cin >> n;
ans = 0; while (n) {
for (int i = 1; i <= n; i++) { ans += (n % 10 - (n % 10 > 7)) * pow(9, m++);
if (!find(i, 7)) { n /= 10;
ans++;
}
} }
cout << ans << endl; cout << ans << endl;
} }