当前位置:网站首页>CF: B. almost Ternary Matrix [symétrie + règles de recherche + Construction + I am Construction Waste]
CF: B. almost Ternary Matrix [symétrie + règles de recherche + Construction + I am Construction Waste]
2022-07-05 18:58:00 【Rétrospective du roi dragon blanc】
Analyse
Tendance à la symétrie,Parce que oui2Multiple de,Alors considérez l'unit é de base2 * 2
1 0 | 0 1
0 1 | 1 0
ABA…
BAB…
…
Nous définissons ci - dessus deux types particuliers de2 * 2DeAEtB
Et puis on peut construireABL'aspect entrelacé,Conforme au premier et au deuxième exemple
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)
Résumé
Je suis une ordure de construction.
Je cherche des petits trucs réguliers
边栏推荐
- 国内低代码开发平台靠谱的都有哪些?
- 彻底理解为什么网络 I/O 会被阻塞?
- 5年经验Android程序员面试27天,2022程序员进阶宝典
- 2022最新中高级Android面试题目,【原理+实战+视频+源码】
- 在通达信上做基金定投安全吗?
- MYSQL中 find_in_set() 函数用法详解
- 自动化测试的好处
- [today in history] July 5: the mother of Google was born; Two Turing Award pioneers born on the same day
- 2022最新大厂Android面试真题解析,Android开发必会技术
- Shang Silicon Valley Shang preferred project tutorial release
猜你喜欢
How to write good code defensive programming
Various pits of vs2017 QT
小程序 修改样式 ( placeholder、checkbox的样式)
UDF implementation of Dameng database
Find in MySQL_ in_ Detailed explanation of set() function usage
企业级数据安全,天翼云是这样理解的
ICML2022 | 长尾识别中分布外检测的部分和非对称对比学习
[today in history] July 5: the mother of Google was born; Two Turing Award pioneers born on the same day
Isprs2022/ cloud detection: cloud detection with boundary nets
技术分享 | 接口测试价值与体系
随机推荐
5年经验Android程序员面试27天,2022程序员进阶宝典
5. 数据访问 - EntityFramework集成
What is text mining? "Suggested collection"
Oracle 中文排序 Oracle 中文字段排序
Interprocess communication (IPC): shared memory
2022最新Android面试笔试,一个安卓程序员的面试心得
Rse2020/ cloud detection: accurate cloud detection of high-resolution remote sensing images based on weak supervision and deep learning
Reptile 01 basic principles of reptile
在通达信上做基金定投安全吗?
R语言使用lubridate包处理日期和时间数据实战
Why can't Bi software do correlation analysis? Take you to analyze
鱼和熊掌可以兼得!天翼云弹性裸金属一招鲜!
Powerful tool for collection processing
SAP feature description
The monthly list of Tencent cloud developer community videos was released in May 2022
输油管的布置数学建模matlab,输油管布置的数学模型
泰山OFFICE技术讲座:由行的布局高度,谈绘制高度的高度溢出、高度缩水(全网首发)
Oracle Chinese sorting Oracle Chinese field sorting
Web3.0时代来了,看天翼云存储资源盘活系统如何赋能新基建(下)
Find in MySQL_ in_ Detailed explanation of set() function usage