結果

問題 No.69 文字を自由に並び替え
ユーザー sasakki
提出日時 2016-05-21 00:46:28
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 486 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 21,376 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 06:14:44
合計ジャッジ時間 773 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |   scanf("%s", str1);
      |   ^~~~~~~~~~~~~~~~~
main.c:11:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |   scanf("%s", str2);
      |   ^~~~~~~~~~~~~~~~~

ソースコード

diff #

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

int main(){
  
  char str1[256];
  char str2[256];
  int cnt[26] = {0};

  scanf("%s", str1);
  scanf("%s", str2);

  int i;
  for(i = 0; i < strlen(str1); i++){
    char c = str1[i];
    cnt[c-97]++;
  }

  for(i = 0; i < strlen(str2); i++){
    char c = str2[i];
    cnt[c-97]--;
  }

  for(i = 0; i < 26; i++){
    if(cnt[i] != 0){
      printf("NO\n");
      break;
    }
    else if(i == 25){
      printf("YES\n");
    }
  }

  return 0;
}
0