結果
| 問題 | No.69 文字を自由に並び替え |
| コンテスト | |
| ユーザー |
nanatutmc
|
| 提出日時 | 2019-09-28 00:46:50 |
| 言語 | C11(gcc12 gnu拡張) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 535 bytes |
| 記録 | |
| コンパイル時間 | 132 ms |
| コンパイル使用メモリ | 31,480 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-08 16:21:14 |
| 合計ジャッジ時間 | 690 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
コンパイルメッセージ
main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
3 | main() {
| ^~~~
main.c: In function ‘main’:
main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%s", str1);
| ^~~~~~~~~~~~~~~~~
main.c:8:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%s", str2);
| ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
main() {
char str1[10], str2[10];
int count1[26], count2[26];
scanf("%s", str1);
scanf("%s", str2);
for (int i=0; i<26; i++) {
count1[i] = count2[i] = 0;
}
for (int i=0; i<10; i++) {
if (str1[i] == 0)
break;
count1[str1[i]-'a']++;
count2[str2[i]-'a']++;
}
for (int i=0; i<26; i++) {
if (count1[i] != count2[i]) {
printf("NO\n");
return 0;
}
}
printf("YES\n");
}
nanatutmc