結果

問題 No.69 文字を自由に並び替え
ユーザー mamo_ICEmamo_ICE
提出日時 2022-12-19 19:43:16
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 895 ms
コンパイル使用メモリ 27,408 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-11 09:54:28
合計ジャッジ時間 1,361 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 0 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:7:5: 警告: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
    7 |     gets(str1);
      |     ^~~~
      |     fgets
/tmp/ccwCrH6C.o: In function `main':
main.c:(.text.startup+0xc): warning: the `gets' function is dangerous and should not be used.

ソースコード

diff #

#include <stdio.h>

int main(void){
    int i, j;
    char str1[11], str2[11], tmp, ans = 1;
    
    gets(str1);
    gets(str2);
    for(i=0; str1[i]; i++){
        for(j=i; str2[j]; j++){
            if(str1[i] == str2[j]){
                tmp = str2[i];
                str2[i] = str2[j];
                str2[j] = tmp;
                break;
            }
        }
        if(str2[j] == '\0'){
            ans = 0;
            break;
        }
    }
    
    if(ans) puts("YES");
    else puts("NO");
    
    return 0;
}
0