結果
| 問題 |
No.39 桁の数字を入れ替え
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2016-11-11 09:30:35 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 341 bytes |
| コンパイル時間 | 673 ms |
| コンパイル使用メモリ | 20,224 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 07:55:26 |
| 合計ジャッジ時間 | 873 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 8 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:14:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%s", s);
| ^~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
void swap(char *a, char *b)
{
char temp;
temp = *a;
*a = *b;
*b = temp;
}
int main(void) {
char s[10];
int i, imax = 0;
scanf("%s", s);
//printf("%s\n", s);
for(i = 0;s[i] != '\0';i++){
if(s[i] >= s[imax])imax = i;
}
//printf("imax = %d\n", imax);
swap(&s[0], &s[imax]);
printf("%s\n", s);
return 0;
}
suppy193