結果
| 問題 | No.69 文字を自由に並び替え | 
| コンテスト | |
| ユーザー |  toto | 
| 提出日時 | 2025-03-26 17:21:11 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 512 bytes | 
| コンパイル時間 | 589 ms | 
| コンパイル使用メモリ | 28,288 KB | 
| 実行使用メモリ | 7,320 KB | 
| 最終ジャッジ日時 | 2025-03-26 17:21:12 | 
| 合計ジャッジ時間 | 1,024 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 WA * 1 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%s",str1);
      |         ~~~~~^~~~~~~~~~~
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%s",str2);
      |         ~~~~~^~~~~~~~~~~
            
            ソースコード
#include <string.h>
#include <stdio.h>
int main(){
	char str1[10],str2[10];
	scanf("%s",str1);
	scanf("%s",str2);
	int len1 = strlen(str1);
	int len2 = strlen(str2);
	
	for(int i = 0;i < len1; i ++){
		for(int j = 0;j < len2; j ++){
			//printf("1:%c 2:%c\n",str1[i],str2[j]);
			if(str1[i] == str2[j]){
				str2[j] = '0';
				break;
			}
		}
	}
	
	for(int i = 0;i < len2;i ++){
		//printf("1:%c 2:%c\n",str1[i],str2[i]);
		if(str2[i] != '0'){
			printf("NO");
			return 0;
		}
	}
	printf("YES");
	
	
}
            
            
            
        