結果
問題 |
No.927 Second Permutation
|
ユーザー |
![]() |
提出日時 | 2020-01-13 19:35:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 452 bytes |
コンパイル時間 | 792 ms |
コンパイル使用メモリ | 67,012 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-21 14:40:00 |
合計ジャッジ時間 | 1,697 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 27 |
ソースコード
#include <iostream> #include <string.h> #include <algorithm> using namespace std; int main(){ int i,j,k,len,count=0; char X[20],tmp; int max; cin>>X; len=strlen(X); for(i=0;i<len;i++){ max=i; for(j=i+1;j<len;j++){ if(X[max]<X[j]) max=j; } tmp=X[i]; X[i]=X[max]; X[max]=tmp; } cout<<X<<endl; j=len-1; while(X[j]==X[j-1]){ j--; } tmp=X[j-1]; X[j-1]=X[j]; X[j]=tmp; cout<<tmp<<endl; cout<<X<<endl; return 0; }