結果
| 問題 | No.39 桁の数字を入れ替え |
| コンテスト | |
| ユーザー |
Naco
|
| 提出日時 | 2019-07-21 19:01:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 369 bytes |
| 記録 | |
| コンパイル時間 | 637 ms |
| コンパイル使用メモリ | 65,228 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-22 17:57:15 |
| 合計ジャッジ時間 | 1,667 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include<iostream>
#include<string>
using namespace std;
int main(){
string N;
cin >> N;
int ans=atoi(N.c_str());
for(int i=0;i<N.size();i++){
for(int j=i+1;j<N.size();j++){
string tmp=N;
swap(tmp[i],tmp[j]);
int res=atoi(tmp.c_str());
ans=max(ans,res);
}
}
cout << ans << endl;
}
Naco