結果

問題 No.69 文字を自由に並び替え
ユーザー Mcpu3Mcpu3
提出日時 2018-07-28 09:37:22
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 489 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 28,804 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-21 00:06:57
合計ジャッジ時間 959 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main(void)
{
    char s[2][11],t;
    int i,j,k;
    for(i=0;i<2;i++){
        gets(s[i]);
        for(j=0;j<strlen(s[i])-1;j++){
            for(k=strlen(s[i])-1;k>j;k--){
                if(s[i][k-1]>s[i][k]){
                    t=s[i][k-1];
                    s[i][k-1]=s[i][k];
                    s[i][k]=t;
                }
            }
        }
    }
    puts(strstr(s[0],s[1])!=NULL?"YES":"NO");
    return 0;
}
0