• 联考Day5


    A.遗忘之祭仪

    暴搜没敢写,,,,,
    直接跳了然后没分

    Code
    #include <iostream>
    #include <cstring>
    #include <cstdio>
    #include <algorithm>
    using namespace std;
    
    inline int read(){
    	int x = 0, w = 1;
    	char ch = getchar();
    	for(; ch > '9' || ch < '0'; ch = getchar()) if(ch == '-') w = -1;
    	for(; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
    	return x * w;
    }
    
    inline void write(register int x){
    	if(x < 0) x = ~x + 1, putchar('-');
    	if(x > 9) write(x / 10);
    	putchar(x % 10 + '0');
    }
    
    const int ss = 1005;
    struct Node {
    	int x, y;
    }d[ss * ss];
    int cnt;
    char c[ss][ss];
    bool flag;
    
    int main() {
    	freopen("prepare.in", "r", stdin);
    	freopen("prepare.out", "w", stdout);
    	register int T = read();
    	while (T--) {
    		flag = cnt = 0;
    		register int n = read(), m = read(), a = read(), b = read();
    		for (int i = 1; i <= n; ++i)
    			scanf("%s", c[i] + 1);
    		for (int i = 0; i < a; ++i) {
    			scanf("%s", c[0]);
    			for (int j = 0; j < b; ++j)
    				if (c[0][j] == 'x')
    					d[++cnt] = (Node) {i, j};
    		}
    		for (int i = cnt; i >= 1; --i)
    			d[i].x -= d[1].x, d[i].y -= d[1].y;
    		for (int i = 1; i <= n && !flag; ++i) {
    			for (int j = 1; j <= m && !flag; ++j) {
    				if (c[i][j] == '.') continue;
    				for (int k = 1; k <= cnt; ++k) {
    					int x = i + d[k].x, y = j + d[k].y;
    					if (x < 1 || x > n || y < 1 || y > m || c[x][y] == '.') 
    						flag = 1, k = cnt;
    					c[x][y] = '.';
    				}
    			}
    		}
    		puts(flag || !cnt ? "No" : "Yes");
    	}
    	return 0;
    }
    

    剩下的不会改了,跳了

  • 相关阅读:
    struts2+jpa+spring 泛型版小结
    PasswordEncoder
    父窗口 子窗口
    Powerdesigner的PDM(物理数据模型)生成数据库及逆向工程(将现有的数据库生成PDM)
    js 正则表达式
    <aop:config>
    CJDBC
    struts2取值
    mysql启动错误1067的解决
    杂碎
  • 原文地址:https://www.cnblogs.com/rui-4825/p/13835805.html
Copyright © 2020-2023  润新知