当前位置:网站首页>F. Jinyu and its outer matrix (construction)
F. Jinyu and its outer matrix (construction)
2022-08-04 14:14:00 【Harris-H】
F.The outer matrix of gold and jade(构造)
The impossible case is that the matrix lengths are divisible separately,显然与2矛盾.
否则有解,Consider putting negative numbers in the upper right corner of each submatrix,then and for-1.There must be more lines in the end,Just a positive number.
selected base m x mx mx要大于 n h × m w \dfrac{n}{h}\times \dfrac{m}{w} hn×wm,The final sum is guaranteed to be positive.
#include<bits/stdc++.h>
using namespace std;
long long n,m,h,w;
int main()
{
cin>>n>>m>>h>>w;
if(n%h==0&&m%w==0)
{
puts("N");
return 0;
}
int mx = (n/h)*(m/w)+1;
puts("Y");
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(i%h==0&&j%w==0)
{
printf("%d ",-mx*w*h+(mx-1));
}
else printf("%d ",mx);
}
printf("\n");
}
}
边栏推荐
猜你喜欢
随机推荐
CCF GLCC officially opened | Kyushu Cloud open source experts bring generous bonuses to help universities promote open source
LM2596有没有可以替代的?LM2576可以
vcl啥意思_oval
Theory 1: Deep Learning - Detailed Explanation of the LetNet Model
Rust from entry to proficient 04-variables
B.构造一个简单的数列(贪心)
爬虫——动作链、xpath、打码平台使用
烂大街的缓存穿透、缓存击穿和缓存雪崩,你真的懂了?
G.登山小分队(暴力&dfs)
SMART S7-200PLC串行自由口通讯(耐压测试仪)
MySQL【窗口函数】【共用表表达式】
Chinese valentine's day, of course, to learn SQL optimization better leave work early to find objects
基于 Next.js实现在线Excel
解题-->在线OJ(十八)
物联网应用发展趋势
Lixia Action | Kyushu Yunzhang Jinnan: Open source is not a movement for a few people, popularization is the source
[深入研究4G/5G/6G专题-50]: URLLC-16-《3GPP URLLC相关协议、规范、技术原理深度解读》-10-高可靠性技术-1-低编码率编码调制方案MCS与高可靠性DRB
AlphaFold 如何实现 AI 在结构生物学中的全部潜力
从理论到实践:MySQL性能优化和高可用架构,一次讲清
集合划分差最小问题(01背包)