結果
問題 | No.69 文字を自由に並び替え |
ユーザー |
![]() |
提出日時 | 2016-08-06 17:10:13 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 21,376 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-14 06:20:35 |
合計ジャッジ時間 | 719 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:24:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 24 | scanf("%s %s", a, b); | ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>#include <string.h>// バブルソートvoid sort(char arg[], int n) {char temp;int i, j;for (i = 0; i < n - 1; i++) {for (j = n - 1; j > i; j--) {if (arg[j] < arg[j - 1]) {temp = arg[j];arg[j] = arg[j - 1];arg[j - 1] = temp;}}}}int main() {char a[11], b[11];int r = 1, i;scanf("%s %s", a, b);sort(a, strlen(a));sort(b, strlen(b));for (i = 0; i < strlen(a); i++) {if (a[i] != b[i]) {r = 0;break;}}if (r == 1) printf("YES\n");else printf("NO\n");return 0;}