标签:its lap bit ber div love size exp ide
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 }
标签:its lap bit ber div love size exp ide
原文地址:https://www.cnblogs.com/chunibyo/p/9384378.html