寒假CF补题计划

咸鱼了好长一段时间了。

开个坑,把之前的一些CF题补了。

等开学就要开始准备考研了,趁着寒假赶紧刷会题,看看能不能冲上紫名,嘤嘤嘤!

这篇博客用来记录简略题解和代码。

1/26

1104C  Grid game

垂直的都先放第一列,满两个就消除。水平的先放(4,3)(避免重叠),再放(4,1),满两个就消除。

 1 #include <set>
 2 #include <map>
 3 #include <queue>
 4 #include <deque>
 5 #include <stack>
 6 #include <cmath>
 7 #include <cstdio>
 8 #include <vector>
 9 #include <string>
10 #include <cstring>
11 #include <fstream>
12 #include <iostream>
13 #include <algorithm>
14 using namespace std;
15 
16 #define eps 1e-8
17 #define pb push_back
18 #define PI acos(-1.0)
19 #define INF 0x3f3f3f3f
20 #define clr(a,b) memset(a,b,sizeof(a)
21 #define bugc(_) cerr << (#_) << " = " << (_) << endl
22 #define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
23 
24 typedef long long ll;
25 typedef unsigned long long ull;
26 char s[1234];
27 bool f1=0,f2=0;
28 
29 int main(){
30     scanf("%s",s+1);
31     int n=strlen(s+1);
32     for(int i=1;i<=n;i++){
33         if(s[i]=='0'){
34             if(!f1) printf("1 1\n"),f1=!f1;
35             else printf("3 1\n"),f1=!f1;
36         }
37         else{
38             if(!f2) printf("4 3\n"),f2=!f2;
39             else printf("4 1\n"),f2=!f2;
40         }
41     }
42     return 0;
43 }
View Code

猜你喜欢

转载自www.cnblogs.com/ehanla/p/10322756.html