結果
| 問題 |
No.2087 基数の変換
|
| コンテスト | |
| ユーザー |
Magentor
|
| 提出日時 | 2022-09-30 21:41:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 538 bytes |
| コンパイル時間 | 791 ms |
| コンパイル使用メモリ | 67,780 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-22 22:50:59 |
| 合計ジャッジ時間 | 2,138 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 51 |
ソースコード
#include <charconv>
#include <iostream>
#include <string>
using namespace std;
int main() {
int base;
std::cin >> base;
int value;
std::cin >> value;
char value_in_base[1 + 128 + 1]; // 最大でもこのくらいの長さ(だろう)
auto result = std::to_chars(std::begin(value_in_base), std::end(value_in_base), value, base);
if (std::errc{} == result.ec) {
*result.ptr = '\0';
cout<<value_in_base<<endl;
} else {
std::cout << "too large" << std::endl;
}
}
Magentor