結果

問題 No.69 文字を自由に並び替え
ユーザー sk3388607083sk3388607083
提出日時 2018-06-21 18:15:08
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 502 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 26,316 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-21 00:05:51
合計ジャッジ時間 833 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

void sort(char *a, int size){
  int i, j;
  char tmp;

  for(i = 0 ; i < size-1; i++){
    for(j = size-1; j > i; j--){
      if(a[j-1] > a[j]){
	tmp = a[j-1];
	a[j-1] = a[j];
	a[j] = tmp;
      }
    }
  }
}
int main(void){
  int i;
  char A[10], B[10];
  scanf("%s", A);
  scanf("%s", B);
  i = 0;
  while(A[i] != '\0') i++;
  sort(A, i);
  i = 0;
  while(B[i] != '\0') i++;
  sort(B, i);
  if(strcmp(A, B)) printf("NO\n");
  else printf("YES\n");
  return 0;
}
0