結果

問題 No.69 文字を自由に並び替え
ユーザー TLwiegehtt
提出日時 2015-07-07 05:14:01
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 438 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 05:58:25
合計ジャッジ時間 885 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[20]’ [-Wformat=]
    9 |         scanf("%s", &a);
      |                ~^   ~~
      |                 |   |
      |                 |   char (*)[20]
      |                 char *
main.c:10:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[20]’ [-Wformat=]
   10 |         scanf("%s", &b);
      |                ~^   ~~
      |                 |   |
      |                 |   char (*)[20]
      |                 char *
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%s", &a);
      |         ^~~~~~~~~~~~~~~
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%s", &b);
      |         ^~~~~~~~~~~~~~~

ソースコード

diff #

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

int main(void){
	int i,j,len;
	int flag = 1;
	char a[20];
	char b[20];
	scanf("%s", &a);
	scanf("%s", &b);
	
	len = strlen(a);
	for(i=0;i<len;i++){
		for(j=0;j<len;j++){
			if(a[i] == b[j]){
				b[j] = '-';
				break;
			}
		}
	}
	
	for(i=0;i<len;i++){
		if('a' <= b[i] && b[i] <= 'z' ){
			flag = 0;
			break;
		}
	}
	
	if(flag == 1){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	
	return 0;
}
0