結果

問題 No.69 文字を自由に並び替え
ユーザー pracodepracode
提出日時 2018-09-19 17:53:00
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 1,294 ms
コンパイル使用メモリ 28,796 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 10:14:29
合計ジャッジ時間 2,072 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 0 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 0 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 0 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>

void swap(char *c1, char*c2);
void alphasort(char str[], int count);

int main()
{
	char str1[11];
	char str2[11];
	int ans;
	int count = 0;

	scanf("%s", str1);
	scanf("%s", str2);

	while (str1[count]!= '\0') {
		count++;
	}

	alphasort(str1,count+1);
	alphasort(str2,count+1);

	ans = strcmp(str1, str2);
	printf("%s", (ans == 0 ? "YES" : "NO"));
	return 0;
}

void swap(char *c1,char *c2)
{
	char temp;

	temp = *c1;
	*c1 = *c2;
	*c2 = temp;
}

void alphasort(char str[], int count)
{
	int i, j;

	for (i = 0; i < count - 1; i++) {
		for (j = 0; j < count - i - i; j++) {
			if ((int)(str[j]) >= (int)(str[j + 1])){
				swap(&str[j], &str[j + 1]);
			}
		}
	}
}
0