Codeforces Round #141 (Div. 2)——B
来源:互联网 发布:sql数据库没有服务器 编辑:程序博客网 时间:2024/06/09 16:56
#include <iostream>#include <cstdio>#include <cstring>using namespace std;#define maxn 100char sa[maxn][maxn];char sb[maxn][maxn];int na,nb,ma,mb;int value(int x,int y){ int sum=0; for(int i=0; i<na; i++) for(int j=0; j<ma; j++) if(x+i>=0&&x+i<nb&&y+j>=0&&y+j<mb) { if(sa[i][j]=='1'&&sb[i+x][j+y]=='1') sum++; } return sum;}int main(){ int i; scanf("%d%d\n",&na,&ma); for(i=0; i<na; i++) scanf("%s",sa[i]); scanf("%d%d\n",&nb,&mb); for(i=0; i<nb; i++) scanf("%s",sb[i]); int max=0; int idx=0,idy=0; for(int x=-50; x<50; x++) for(int y=-50; y<50; y++) { int sum=value(x,y); if(max<sum) { max=sum; idx=x; idy=y; } } printf("%d %d\n",idx,idy); return 0;}
- Codeforces Round #141 (Div. 2)——B
- Codeforces Round #154 (Div. 2)——B
- Codeforces Round #156 (Div. 2)——B
- Codeforces Round #151 (Div. 2)——B
- Codeforces Round #152 (Div. 2)——B
- Codeforces Round #149 (Div. 2)——B
- Codeforces Round #146 (Div. 2)——B
- Codeforces Round #144 (Div. 2)——B
- Codeforces Round #142 (Div. 2)——B
- Codeforces Round #157 (Div. 2)——B
- Codeforces Round #134 (Div. 2)——B
- Codeforces Round #140 (Div. 2)——B
- Codeforces Round #137 (Div. 2)——B
- Codeforces Round #136 (Div. 2)——B
- Codeforces Round #135 (Div. 2)——B
- Codeforces Round #124 (Div. 2)——B
- Codeforces Round #123 (Div. 2)——B
- Codeforces Round #117 (Div. 2)——B
- 小算法酱油笔记之数组压缩0
- ndk make: *** 没有规则可以创建
- 绑定变量(bind variables)、替换变量(substitution variables)
- 大家一起番茄吧!
- sqlite3 查询数据库表结构
- Codeforces Round #141 (Div. 2)——B
- 【OpenCV入门指南】第十一篇 鼠标绘图
- png转换OpenGL Texture
- Android酱油笔记之自定义View的宽高
- java.lang.IllegalArgumentException: no dialog with id 1 was ever shown via Activity#showDialog
- How to get the data from a cell when I click on the GridButtonColumn of the same row
- C++第二次测验——二维数组各行各列之和
- 软件开发者最重要的四大技能
- zoj 1001纪念我的第一个java ACM题