Files
python/LuoGu/RuMen/P1590.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

30 lines
798 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;
typedef long long ll;
int main() {
int time, t; //time:输入测试数据次数 t:数字的每一位
ios::sync_with_stdio(false);//读入输出优化的强迫症= =
cin >> time;
//按次数输入数据
for (int i = 0; i < time; i++) {
ll x;
cin >> x; //输入的数据
ll p = 0; //9的几次方
ll ans = 0; //有多少个?
//模拟9进制
while (x) {
//取个位
t = x % 10;
//如果比7大那么实际是要小一个的
if (t >= 7) t--;
//计算有多少个?
ans += t * pow(9, p);
x = x / 10;
p++;
}
cout << ans << endl;
}
}