結果
| 問題 | No.69 文字を自由に並び替え | 
| コンテスト | |
| ユーザー |  Hissha_ | 
| 提出日時 | 2018-04-02 10:23:56 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 486 bytes | 
| コンパイル時間 | 140 ms | 
| コンパイル使用メモリ | 22,656 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-12-14 07:00:52 | 
| 合計ジャッジ時間 | 760 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 WA * 1 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:26: warning: NULL used in arithmetic [-Wpointer-arith]
   13 |                 if(a[i]==NULL){
      |                          ^~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%s", a);
      |         ~~~~~^~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%s", b);
      |         ~~~~~^~~~~~~~~
            
            ソースコード
#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;
}
            
            
            
        