結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
|
提出日時 | 2023-05-01 11:04:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 407 bytes |
コンパイル時間 | 546 ms |
コンパイル使用メモリ | 67,544 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-20 10:45:59 |
合計ジャッジ時間 | 1,436 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 8 |
ソースコード
#include <iostream> #include <vector> #include <string> using namespace std; int main() { int N; cin >> N; string Ns = to_string(N); int maxdigit = 0; int maxidx = -1; for (int i = 0; i < (int)Ns.size(); ++i) { if (maxdigit <= Ns[i] - '0') { maxdigit = Ns[i] - '0'; maxidx = i; } } swap(Ns[0], Ns[maxidx]); cout << Ns << endl; }