結果

問題 No.69 文字を自由に並び替え
ユーザー spacenautspacenaut
提出日時 2016-05-12 21:34:50
言語 C90
(gcc 11.4.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 541 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 24,656 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-20 23:19:38
合計ジャッジ時間 1,175 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 0 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 0 ms
4,380 KB
testcase_06 AC 0 ms
4,380 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 0 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 0 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:12: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
  int len = strlen(a);
            ^~~~~~
main.c:9:12: warning: incompatible implicit declaration of built-in function ‘strlen’
main.c:9:12: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
main.c:2:1:
+#include <string.h>
 
main.c:9:12:
  int len = strlen(a);
            ^~~~~~
main.c:29:5: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
  if(strcmp(a, b) == 0){
     ^~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
	char a[10];
	char b[10];
	char temp;
	int i, j;
	scanf("%s%s", a, b);
	int len = strlen(a);
	
	for(i = 0; i < len - 1; i++){
		for(j = 0; j < len - 1 - i; j++){
			if(a[j] > a[j + 1]){
				temp = a[j];
				a[j] = a[j + 1];
				a[j + 1] = temp;
			}
		}
	}
	for(i = 0; i < len - 1; i++){
		for(j = 0; j < len - 1 - i; j++){
			if(b[j] > b[j + 1]){
				temp = b[j];
				b[j] = b[j + 1];
				b[j + 1] = temp;
			}
		}
	}
	if(strcmp(a, b) == 0){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	
	return 0;
}
0