結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
![]() |
提出日時 | 2014-10-16 15:41:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 334 bytes |
コンパイル時間 | 415 ms |
コンパイル使用メモリ | 33,988 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 09:20:11 |
合計ジャッジ時間 | 1,034 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | char s[100];scanf("%s",s); | ~~~~~^~~~~~~~
ソースコード
#include <stdio.h> #include <algorithm> #include <string.h> using namespace std; //184 名前が184 int main(){ char s[100];scanf("%s",s); int len=strlen(s); int mxidx=0; len;; for(int i=0,n=0;n<1;i++,n=i/len)if(s[mxidx]<s[i])mxidx=i; else if(s[i]<s[mxidx]){ swap(s[i],s[mxidx]);return 0; } printf("%s\n",s); }