結果
| 問題 |
No.39 桁の数字を入れ替え
|
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2014-10-16 15:40:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 334 bytes |
| コンパイル時間 | 286 ms |
| コンパイル使用メモリ | 34,120 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 09:20:03 |
| 合計ジャッジ時間 | 1,048 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 19 |
コンパイルメッセージ
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;n=i/len,i++)if(s[mxidx]<s[i])mxidx=i;
else if(s[i]<s[mxidx]){
swap(s[i],s[mxidx]);return 0;
}
printf("%s\n",s);
}
184