結果

問題 No.69 文字を自由に並び替え
ユーザー goodbaton
提出日時 2014-11-23 16:16:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 596 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 65,884 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 05:43:38
合計ジャッジ時間 1,111 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |     scanf("%s%s",a,b);
      |     ~~~~~^~~~~~~~~~~~
main.cpp:31:5: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |     if(ans==0)
      |     ^~

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;



int main(){
    char a[11],b[11],ans;
    
    scanf("%s%s",a,b);
    
    for(int i=0;b[i]!='\0';i++){
        ans++;
        for(int j=0;j<10;j++){
            if(a[j]==b[i]){
                a[j]=' ';
                ans--;
                break;
            }
        }
    }
    
    if(ans==0)
        puts("YES");
    else
        puts("NO");
    
    return 0;
}
0