当前位置:网站首页>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
边栏推荐
- AI Open2022|基于异质信息网络的推荐系统综述:概念,方法,应用与资源
- 从外卖点单浅谈伪需求
- Chinese postman? Really powerful!
- Reading notes of Clickhouse principle analysis and Application Practice (5)
- Use QT to traverse JSON documents and search sub objects
- A cloud opens a new future of smart transportation
- Case sharing | integrated construction of data operation and maintenance in the financial industry
- [today in history] July 5: the mother of Google was born; Two Turing Award pioneers born on the same day
- Icml2022 | partial and asymmetric comparative learning of out of distribution detection in long tail recognition
- 跨境支付平台 XTransfer 的低代码实践:如何与其他中台融合是核心
猜你喜欢
2022全网最全的腾讯后台自动化测试与持续部署实践【万字长文】
Icml2022 | partial and asymmetric comparative learning of out of distribution detection in long tail recognition
Interprocess communication (IPC): shared memory
决策树与随机森林
中文版Postman?功能真心强大!
Solutions contents have differences only in line separators
Technology sharing | interface testing value and system
解决 contents have differences only in line separators
Various pits of vs2017 QT
android中常见的面试题,2022金九银十Android大厂面试题来袭
随机推荐
Reptile 01 basic principles of reptile
The monthly list of Tencent cloud developer community videos was released in May 2022
Benefits of automated testing
Mathematical modeling of oil pipeline layout MATLAB, mathematical model of oil pipeline layout
AI金榜题名时,MLPerf榜单的份量究竟有多重?
瞅一瞅JUC提供的限流工具Semaphore
Golang through pointer for Range implements the change of the value of the element in the slice
RPC protocol details
max31865模块RTD测温注意事项
What is text mining? "Suggested collection"
Common time complexity
5. Data access - entityframework integration
MYSQL中 find_in_set() 函数用法详解
为什么 BI 软件都搞不定关联分析?带你分析分析
R语言使用lubridate包处理日期和时间数据实战
Interprocess communication (IPC): shared memory
怎么自动安装pythn三方库
基于can总线的A2L文件解析(3)
China law network joins hands to observe the cloud, and the online system is a full link observable platform
Postman核心功能解析 —— 参数化和测试报告