結果

問題 No.69 文字を自由に並び替え
コンテスト
ユーザー sasa
提出日時 2025-03-04 09:30:40
言語 C
(gcc 15.2.0)
結果
CE  
(最新)
WA  
(最初)
実行時間 -
コード長 594 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 96 ms
コンパイル使用メモリ 27,616 KB
最終ジャッジ日時 2026-02-22 12:50:32
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'main':
main.c:5:22: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
    5 |         char *strA = malloc(11);
      |                      ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:5:22: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
    5 |         char *strA = malloc(11);
      |                      ^~~~~~
main.c:5:22: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:7:19: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    7 |         int lena =strlen(strA);
      |                   ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:7:19: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    7 |         int lena =strlen(strA);
      |                   ^~~~~~
main.c:7:19: note: include '<string.h>' or provide a declaration of 'strlen'

ソースコード

diff #
raw source code

#include <stdio.h>

int main(void){
	// 文字列Aをスキャン・ポインタ
	char *strA = malloc(11);
	scanf("%s",strA);
	int lena =strlen(strA);
	char *a = strA;
	// 文字列Bをスキャン・ポインタ
	char *strB = malloc(11);
	scanf("%s",strB);
	int lenb = strlen(strB);
	char *b = strB;
	int count = 0;
	int ans = 0;
	for(int i = 0;i < lena;i++){
		count = 0;
		for(int j = 0;j < lenb;j++){
			if(a[i] == b[j]){
				b[i] = '\0';
				count++;
				break;
			}
		}
		if(count == 0){
			printf("NO");
			break;
		}
		else{
			ans++;
		}
	}
	if(ans == lenb){
		printf("YES");
	}
	
	

}
0