結果
問題 | No.927 Second Permutation |
ユーザー |
![]() |
提出日時 | 2020-03-31 02:18:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 445 bytes |
コンパイル時間 | 1,941 ms |
コンパイル使用メモリ | 170,324 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 12:04:21 |
合計ジャッジ時間 | 3,019 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;// 条件を見落としていませんか?int main () {string S;cin >> S;sort(S.begin(), S.end());reverse(S.begin(), S.end());int i = 1;do {if (i == 2) {if (S[0] == '0') break;cout << S << endl;return 0;}i++;} while(prev_permutation(S.begin(), S.end()));puts("-1");}