結果
| 問題 | No.39 桁の数字を入れ替え |
| コンテスト | |
| ユーザー |
たこし
|
| 提出日時 | 2014-11-13 18:15:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 929 bytes |
| 記録 | |
| コンパイル時間 | 682 ms |
| コンパイル使用メモリ | 89,320 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-02 05:54:16 |
| 合計ジャッジ時間 | 1,389 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
#define INF 1000000000
#define EPS 1e-9
#define PI acos(-1)
typedef long long ll;
typedef pair<int, int> P;
string str;
int ans;
int main(){
int N;
cin >> N;
stringstream ss;
ss << N;
str = ss.str();
int ans = 0;
for(int i = 0; i < str.length(); i++){
for(int j = i; j < str.length(); j++){
swap(str[i], str[j]);
ans = max(ans, atoi(str.c_str()));
swap(str[i], str[j]);
}
}
cout << ans << endl;
return 0;
}
たこし