File tree Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ #include < bits/stdc++.h>
2+
3+ #define MX 1e4 +5
4+
5+ using namespace std ;
6+
7+ typedef pair<int , int > pii;
8+ typedef vector<int > vi;
9+ typedef vector<pii> vii;
10+
11+
12+ void test_case () {
13+
14+ int x, y;
15+ cin >> x >> y;
16+ cout << (2 * x > y ? " YES\n " : " NO\n " );
17+ }
18+
19+
20+ int main () {
21+
22+ int T;
23+ cin >> T;
24+
25+ while (T--) {
26+ test_case ();
27+ }
28+
29+ return 0 ;
30+ }
Original file line number Diff line number Diff line change 1+ #include < bits/stdc++.h>
2+
3+ #define MX 1e4 +5
4+
5+ using namespace std ;
6+
7+ typedef pair<int , int > pii;
8+ typedef vector<int > vi;
9+ typedef vector<pii> vii;
10+
11+
12+ void test_case () {
13+
14+ int n;
15+ cin >> n;
16+
17+ string s;
18+ cin >> s;
19+
20+ int cnt = 0 ;
21+ for (int i = 0 ; i < n - 1 ; i++)
22+ if (s[i] == s[i+1 ])
23+ cnt++;
24+ cout << (cnt + 1 ) / 2 << " \n " ;
25+ }
26+
27+
28+ int main () {
29+
30+ int T;
31+ cin >> T;
32+
33+ while (T--) {
34+ test_case ();
35+ }
36+
37+ return 0 ;
38+ }
You can’t perform that action at this time.
0 commit comments