結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
![]() |
提出日時 | 2021-01-25 20:25:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 348 bytes |
コンパイル時間 | 1,432 ms |
コンパイル使用メモリ | 167,708 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 15:49:48 |
合計ジャッジ時間 | 2,138 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ string s; cin >> s; int a = s[0]-'0'; int mx = a; for(int i = 1; i < s.size(); i++){ mx = max(mx, s[i]-'0'); } int at = 0; for(int i = 1; i < s.size(); i++){ if(s[i]-'0'==mx) at = i; } swap(s[0], s[at]); cout << s << endl; return 0; }