結果

問題 No.1367 文字列門松
ユーザー chocorusk
提出日時 2021-02-06 18:47:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,003 bytes
コンパイル時間 965 ms
コンパイル使用メモリ 124,376 KB
最終ジャッジ日時 2025-01-18 13:40:44
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <stack>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    string s; cin>>s;
    string t="kadomatsu";
    int m=s.size();
    int n=t.size();
    for(int i=0; i<(1<<n); i++){
        if(popcount(i)!=m) continue;
        int k=0;
        bool dame=0;
        for(int j=0; j<n; j++){
            if(!(i&(1<<j))) continue;
            if(s[k]!=t[j]){
                dame=1;
            }
            k++;
        }
        if(!dame){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}
0