Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits\stdc++.h>
- using namespace std;
- int main()
- {
- int t;
- scanf("%d", &t);
- while(t--)
- {
- int n, i;
- scanf("%d", &n);
- string s;
- cin >> s;
- int f = 0;
- for(i = 0; i <= 4; i++)
- {
- if(s.substr(0, i) + s.substr(n - 4 + i, 4 - i) == "2020")
- {
- f = 1;
- printf("YES\n");
- break;
- }
- }
- if(f == 0) printf("NO\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment