結果
| 問題 |
No.256 桁の数字を入れ替え (2)
|
| コンテスト | |
| ユーザー |
yamaken1343
|
| 提出日時 | 2015-11-10 22:12:07 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 344 bytes |
| コンパイル時間 | 199 ms |
| コンパイル使用メモリ | 21,376 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 14:22:14 |
| 合計ジャッジ時間 | 845 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 RE * 2 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%s",c);
| ^~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<string.h>
int main(void){
char c[10000] = {};
char buf,max= '0';
int i,j,l,m=0,k;
scanf("%s",c);
l = strlen(c);
for(i=0;i<l;i++){
m = i;
max = '0';
for(j=i;j<l;j++){
if(max < c[j]){
m = j;
max = c[i];
k++;
}
}
buf = c[i];
c[i] = c[m];
c[m] = buf;
}
printf("%s",c);
return 0;
}
yamaken1343