AtCoder Beginner Contest 250 A~E
A - Adjacent Squares
题意:给出一个行列为H,W的矩阵,再给一个坐标,问周围有多少个正方形。
// Problem: C - Adjacent Swaps
// Contest: AtCoder - AtCoder Beginner Contest 250
// URL: https://atcoder.jp/contests/abc250/tasks/abc250_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
#include<bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef vector<int> VI;
const int mod=1000000007;
ll powmod(ll a,ll b) {
ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){
if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) {
return b?gcd(b,a%b):a;}
int main(){
int n,m;
int a,b;
cin>>n>>m>>a>>b;
int ans = 0;
if(a > 1) ans ++;
if(b > 1) ans ++;
if(a < n) ans ++;
if(b < m) ans ++;
cout<<ans;
return 0;
}
B - Enlarged Checker Board
题意:给出n*n的正方形矩阵,对地板染色,有黑白两种色 ,要求相邻两个的地板颜色不同,(1,1)为白色,给出每块地板的大小。
// Problem: B - Enlarged Checker Board
// Contest: AtCoder - AtCoder Beginner Contest 250
// URL: https://atcoder.jp/contests/abc250/tasks/abc250_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
#include<bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef vector<int> VI;
const int mod=1000000007 , N = 110;
ll powmod(ll a,ll b) {
ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){
if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll