#include #include #include #include #include using namespace std; #define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "< std::string Itoa(const TypeInt v, int base) { static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string ret; static numeric_limits t; TypeInt n = v; if (t.is_signed) { if (v < 0) n *= -1; } while (n >= base) { ret += table[n%base]; n /= base; } ret += table[n]; if (t.is_signed) { if (v < 0 && base == 10) ret += '-'; } // 文字列の順番を逆にする std::reverse(ret.begin(), ret.end()); return ret; } int main(){ sci(N) cout << Itoa(N, 7) << endl; }