-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_New_Year_String.cpp
More file actions
113 lines (87 loc) · 2.59 KB
/
A_New_Year_String.cpp
File metadata and controls
113 lines (87 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//#include <ext/pb_ds/detail/standard_policies.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//void myerase(ordered_set &t, int v){
// int rank = t.order_of_key(v);//Number of elements that are less than v in t
// ordered_set::iterator it = t.find_by_order(rank); //Iterator that points to the (rank+1)th element in t
// t.erase(it);
//}
#define int long long
#define ll long long
#define nl cout<<endl;
#define raaz ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define take(n) int n; cin>>n;
#define takearr(a,n) int a[n]; for(int i=0; i<n; i++) cin>>a[i];
#define takevec(a,n) vector<int> a(n); for(int i=0; i<n; i++) cin>>a[i];
#define sortv(v) sort(v.begin(),v.end());
#define sortarr(arr,n) sort(arr,arr+n);
#define show(ds) for(auto it: ds) cout<<it<<" ";cout<<endl;
#define pb push_back
#define pl cout<<endl;
#define ps cout<<" ";
#define pY cout<<"YES"<<endl;
#define pN cout<<"NO"<<endl;
#define py cout<<"Yes"<<endl;
#define pn cout<<"No"<<endl;
#define ff(i,a,n) for(int i = a;i<n;i++)
#define fl(i,a,n) for(int i = n-1;i>=a;i--)
bool isPrime(int n){
if(n<=1){
return false;
}
for(int i = 2;i*i<=n;i++){
if(n%i==0){
return false;
}
}
return true;
}
bool sbs(const pair<int,int>&a,const pair<int,int>&b){
return a.second<b.second;
}
long long binpow(long long a, long long b, long long m) {
a %= m;
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
void solve(){
int ans=4;
int n;cin>>n;
string s;cin>>s;
// find 2026
for(int i=0;i+3<n;i++){
if(s[i]=='2' && s[i+1]=='0' && s[i+2]=='2' && s[i+3]=='6'){
cout<<0;pl;
return;
}
}
for(int i=0;i+3<n;i++){
if(s[i]=='2' && s[i+1]=='0' && s[i+2]=='2' && s[i+3]=='5'){
cout<<1;pl;
return;
}
}
cout<<0;pl;
}
int32_t main(){
raaz
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
int test_case=1;
cin>>test_case;
for(int xyz=1;xyz<=test_case;xyz++){
// cout<<"Case #"<<xyz<<": ";
solve(); };
return 0;
}