1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【AtCoder】使えそうな関数

Posted at

【随時追加予定】

10進数をn進数に変換する関数

// 10進数をn進数(文字列)に変換する関数
string to_n_system(int sys, int x) {
  string res = "";
  do {
    res += to_string(x % sys);
    x /= sys;
  } while (x != 0);
  reverse(res.begin(), res.end());
  
  return res;
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?