結果
問題 | No.1367 文字列門松 |
ユーザー |
|
提出日時 | 2021-01-29 21:26:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 370 bytes |
コンパイル時間 | 512 ms |
コンパイル使用メモリ | 64,640 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 07:33:51 |
合計ジャッジ時間 | 1,317 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream>using namespace std;string s;string t="kadomatsu";main(){cin>>s;int comb=(1<<s.size())-1;while(comb<1<<9){bool ok=true;int sz=0;for(int j=0;j<9;j++)if(comb>>j&1){if(t[j]!=s[sz++])ok=false;}if(ok){cout<<"Yes"<<endl;return 0;}int x=comb&-comb,y=comb+x;comb=(comb&~y)/x>>1|y;}cout<<"No"<<endl;}