luyencode / comments

Server lưu trữ bình luận trên Luyện Code
https://luyencode.net
6 stars 3 forks source link

https://oj.luyencode.net/problem/JEWELS #734

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Chuỗi ngọc - Luyện Code Online

https://luyencode.net/problem/JEWELS

ghost commented 2 years ago

Đây là lời giải của mình đã AC. Nếu bạn đã cố gắng mà chưa làm được thì có thể tham khảo lời giải của mình.

Xem code AC

```cpp #include #define FOR(i, l, r) for(int i = l; i <= r; ++i) #define FOD(i, l, r) for(int i = l; i >= r; --i) #define pos(s1, s2) s2.find(s1) #define ll long long using namespace std; // Topic variable. int n, k; string s; // Auxiliary variable. string st; //___________________ int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; cin.ignore(); getline(cin, s); s += s; while (k) { getline(cin, st); if (pos(st, s) != -1) cout << "YES"; else cout << "NO"; cout << endl; --k; } return 0; } ```