結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:12: warning: NULL used in arithmetic [-Wpointer-arith]
   if(a[i]==NULL){
            ^~~~

ソースコード

diff #

#include <stdio.h>

int main(void) {
	// your code goes here
	char a[10], b[10];
	char c;
	int i, j, n, counta=0, countb=0;
	
	scanf("%s", a);
	scanf("%s", b);
	
	for(i=0;i<11;i++){
		if(a[i]==NULL){
			n=i;
			break;
		} 
	}
	
	for(i=0;i<n;i++){
		c=a[i];
		for(j=0;j<n;j++){
			if(a[j]==c) counta++;
		}
		for(j=0;j<n;j++){
			if(b[j]==c) countb++;
		}
		if(counta!=countb){
			printf("%s\n","NO");
			return 0;
		}
		counta=0;
		countb=0;
	}
	
	printf("%s\n","YES");
	

	return 0;
}
0