0728 补题 + 题解
Posted chunibyo
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了0728 补题 + 题解相关的知识,希望对你有一定的参考价值。
K - Robots POJ - 1548
直接暴力就可以了
1 /* 2 Fuck you. 3 I love you too. 4 */ 5 6 //#include<bits/stdc++.h> 7 #include<iostream> 8 #include<cstdio> 9 #include<cmath> 10 #include<cstring> 11 #define mem(a,x) memset(a,x,sizeof(a)) 12 13 14 const double PI = acos (-1.0); 15 const int INF = 0x3f3f3f3f; 16 const int EXP = 1e-8; 17 const int N = 1e5 + 5; 18 const int MOD = 1e9 + 7; 19 const int MAXN = 1e5 + 5; 20 21 using namespace std; 22 23 int a[30][30]; 24 int x, y; 25 int cnt, number, m, n; 26 int lazy; 27 28 int main() { 29 mem (a, 0), cnt = number = m = n = 0, lazy = 1; 30 while (cin >> x >> y, x != -1 && y != -1) { 31 if (x == 0 && y == 0) { 32 while (number != 0) { 33 lazy=1; 34 for (int i = 1; i <= m; i++) { 35 for (int j = lazy; j <= n; j++) { 36 if (a[i][j] == 1) { 37 for (int k = j; k <= n; k++) { 38 if (a[i][k] == 1) { 39 a[i][k] = 0, lazy = k, number--; 40 //cout << i << ‘ ‘ << k << endl; 41 } 42 } 43 } 44 } 45 } 46 cnt++; 47 } 48 cout << cnt << endl; 49 mem (a, 0), cnt = number = m = n = 0, lazy = 1; 50 } else { 51 a[x][y] = 1; 52 m = max (x, m), n = max (y, n); 53 number++; 54 } 55 } 56 return 0; 57 }
以上是关于0728 补题 + 题解的主要内容,如果未能解决你的问题,请参考以下文章
2021/11/21 ICPC沈阳站个人题解B,E,F,J(附赛时记录,另附赛后补题代码I,M)
2018-2019赛季多校联合新生训练赛第三场(2018/12/8)补题题解