library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub beet-aizu/library

:heavy_check_mark: test/aoj/0233.test.cpp

Depends on

Code

// verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0233

#include<bits/stdc++.h>
using namespace std;

#define call_from_test
#include "../../math/convertbase.cpp"
#undef call_from_test

signed main(){
  long long p;
  while(cin>>p,p){
    auto ans=convert_base(p,-10LL);
    for(auto x:ans) cout<<x;
    cout<<endl;
  }
  return 0;
}
#line 1 "test/aoj/0233.test.cpp"
// verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0233

#include<bits/stdc++.h>
using namespace std;

#define call_from_test
#line 1 "math/convertbase.cpp"

#line 3 "math/convertbase.cpp"
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T>
vector<T> convert_base(T x,T b){
  vector<T> res;
  T t=1,k=abs(b);
  while(x){
    res.emplace_back((x*t)%k);
    if(res.back()<0) res.back()+=k;
    x-=res.back()*t;
    x/=k;
    t*=b/k;
  }
  if(res.empty()) res.emplace_back(0);
  reverse(res.begin(),res.end());
  return res;
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
  return 0;
}
#endif
#line 8 "test/aoj/0233.test.cpp"
#undef call_from_test

signed main(){
  long long p;
  while(cin>>p,p){
    auto ans=convert_base(p,-10LL);
    for(auto x:ans) cout<<x;
    cout<<endl;
  }
  return 0;
}
Back to top page