結果
| 問題 |
No.69 文字を自由に並び替え
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-09 17:14:34 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 539 bytes |
| コンパイル時間 | 277 ms |
| コンパイル使用メモリ | 20,992 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-14 06:07:41 |
| 合計ジャッジ時間 | 908 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 1 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%s", str_a);
| ^~~~~~~~~~~~~~~~~~
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%s", str_b);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void)
{
int i;
char str_a[10];
char str_b[10];
int word_a[26] = {0};
int word_b[26] = {0};
scanf("%s", str_a);
scanf("%s", str_b);
for ( i = 0; str_a[i] != '\0'; i++ ) {
if ('a' <= str_a[i] && str_a[i] <= 'z') {
word_a[str_a[i] - 'a']++;
}
}
for ( i = 0; str_b[i] != '\0'; i++ ) {
if ('a' <= str_b[i] && str_b[i] <= 'z') {
word_b[str_b[i] - 'a']++;
}
}
for ( i = 0; i < 26; i++ ) {
if ( word_a[i] != word_b[i] ) {
puts("NO");
return 0;
}
}
puts("YES");
return 0;
}