题目大意:里程表会错过0 1 2 3 4 5 6 7 8 9中的 3 和 8 两个数字 也就是 正常的里程表显示0 1 2 3 4 5 6 7 8 9
坏掉的里程表只会显示 0 1 2 4 5 6 7 9
其实可以看做:0 1 2 3 4 5 6 7 即坏掉的里程表显示的是8进制的数字,只需先将显示的数字换成8进制数,在把8进制数字换位10进制数字就是答案。
#include <iostream>
#include <map>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <string>
using namespace std;
map<char ,char> mp;
string str;
long long ans;
long long trans(long long a){
int y,b=0,i=0;
while(a>=1){
y=a%10;
b+=y*pow(8.0,i);
i++;
a=a/10;
}
return b;
}
long long fuck(){
string tps;
int len=str.length();
long long tmp,tp;
for(int i=0;i<len;i++){
tps.push_back(mp[str[i]]);
}
stringstream ss(tps);
ss>>tmp;
tp=trans(tmp);