当前位置:网站首页>Cf:b. almost Terry matrix [symmetry + finding rules + structure + I am structural garbage]
Cf:b. almost Terry matrix [symmetry + finding rules + structure + I am structural garbage]
2022-07-05 18:59:00 【White speed Dragon King's review】
analysis
Tend to symmetry , Because it is 2 Multiple , So consider basic units 2 * 2
1 0 | 0 1
0 1 | 1 0
ABA…
BAB…
…
We have defined two special 2 * 2 Of A and B
Then it can be constructed AB Staggered appearance , Conform to the first and second examples
ac code
import sys
input = sys.stdin.readline
for _ in range(int(input())):
n, m = list(map(int, input().split()))
# 1 0 | 0 1
# 0 1 | 1 0
# ABA...
# BAB...
# ...
even = [1, 0, 0, 1]
odd = [0, 1, 1, 0]
ans = [[0] * m for _ in range(n)]
for i in range(n):
for j in range(m):
if i % 4 == 0 or i % 4 == 3:
ans[i][j] = even[j % 4]
else:
ans[i][j] = odd[j % 4]
for row in ans:
print(*row)
summary
I'm construction garbage
I'm looking for regular little garbage
边栏推荐
- 企业级数据安全,天翼云是这样理解的
- Oracle 中文排序 Oracle 中文字段排序
- Word finds red text word finds color font word finds highlighted formatted text
- 达梦数据库udf实现
- UDF implementation of Dameng database
- Simple query cost estimation
- C final review
- Deep copy and shallow copy [interview question 3]
- 2022最新大厂Android面试真题解析,Android开发必会技术
- The road of enterprise digital transformation starts from here
猜你喜欢
Take a look at semaphore, the current limiting tool provided by JUC
UDF implementation of Dameng database
The era of Web3.0 is coming. See how Tianyi cloud storage resources revitalize the system to enable new infrastructure (Part 2)
Overview of video self supervised learning
Low code practice of xtransfer, a cross-border payment platform: how to integrate with other medium-sized platforms is the core
【Autosar 十四 启动流程详解】
Reptile 01 basic principles of reptile
MYSQL中 find_in_set() 函数用法详解
决策树与随机森林
AI金榜题名时,MLPerf榜单的份量究竟有多重?
随机推荐
EMQX 5.0 正式发布:单集群支持 1 亿 MQTT 连接
Technology sharing | interface testing value and system
Solutions contents have differences only in line separators
Ant group open source trusted privacy computing framework "argot": open and universal
c语言简便实现链表增删改查「建议收藏」
SAP feature description
7-2 keep the linked list in order
R language uses lubridate package to process date and time data
技术分享 | 接口测试价值与体系
Linear table - abstract data type
Various pits of vs2017 QT
How much does the mlperf list weigh when AI is named?
案例分享|金融业数据运营运维一体化建设
websocket 工具的使用
Precautions for RTD temperature measurement of max31865 module
EasyCVR授权到期页面无法登录,该如何解决?
国内低代码开发平台靠谱的都有哪些?
Windows Oracle open remote connection Windows Server Oracle open remote connection
MYSQL中 find_in_set() 函数用法详解
企业数字化转型之路,从这里开始