'commit'
This commit is contained in:
30
LuoGu/RuMen/P1590.cpp
Normal file
30
LuoGu/RuMen/P1590.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user