当前位置:网站首页>Mirror Grid
Mirror Grid
2022-07-25 12:11:00 【Lie drunk and wake up in a dream】
Mirror Grid
The question :
Given a n * n The rectangular , Rotate it 90°,180°,270° Keep the same after . Ask how many steps you need to complete at least .
Ideas :
According to the meaning of the title, this matrix must be a centrosymmetric figure , So traverse every layer of this rectangle , Check every time 0 More or less 1 Just more
a key : ergodic matrix
AC Code :
#include <iostream>
#include <algorithm>
using namespace std;
int a[105][105];
int main(){
int t;cin >> t;
while(t --){
int n;cin >> n;
for(int i = 1;i <= n;i ++)
for(int j = 1;j <= n;j ++){
char x;cin >> x;
a[i][j] = x - '0';
}
int ans = 0;
for(int i = 1;i <= (n + 1) / 2;i ++){
for(int j = 1;j <= n / 2;j ++){
int x = a[i][j] + a[j][n-i+1] + a[n-i+1][n-j+1] + a[n-j+1][i];
ans += min(4 - x,x);
}
}
cout << ans << endl;
}
return 0;
}
边栏推荐
- Zero-Shot Image Retrieval(零样本跨模态检索)
- OSPF综合实验
- 【AI4Code】《CodeBERT: A Pre-Trained Model for Programming and Natural Languages》 EMNLP 2020
- 一文入门Redis
- 知识图谱用于推荐系统问题(MVIN,KERL,CKAN,KRED,GAEAT)
- [untitled]
- 【RS采样】A Gain-Tuning Dynamic Negative Sampler for Recommendation (WWW 2022)
- Hydrogen entrepreneurship competition | Liu Yafang, deputy director of the science and Technology Department of the National Energy Administration: building a high-quality innovation system is the cor
- Brpc source code analysis (IV) -- bthread mechanism
- Feign使用
猜你喜欢

Learning to pre train graph neural networks

Intelligent information retrieval (overview of intelligent information retrieval)

【CTR】《Towards Universal Sequence Representation Learning for Recommender Systems》 (KDD‘22)

【GCN-RS】Learning Explicit User Interest Boundary for Recommendation (WWW‘22)

硬件连接服务器 tcp通讯协议 gateway

Solutions to the failure of winddowns planning task execution bat to execute PHP files

Meta learning (meta learning and small sample learning)

OSPF comprehensive experiment

通过Referer请求头实现防盗链

【微服务~Sentinel】Sentinel降级、限流、熔断
随机推荐
Learning to Pre-train Graph Neural Networks(图预训练与微调差异)
OSPF综合实验
【AI4Code】《Unified Pre-training for Program Understanding and Generation》 NAACL 2021
从云原生到智能化,深度解读行业首个「视频直播技术最佳实践图谱」
'C:\xampp\php\ext\php_zip.dll' - %1 不是有效的 Win32 应用程序 解决
Week303 of leetcode (20220724)
selenium使用———安装、测试
【AI4Code】《Pythia: AI-assisted Code Completion System》(KDD 2019)
Meta-learning(元学习与少样本学习)
Knowledge maps are used to recommend system problems (mvin, Ctrl, ckan, Kred, gaeat)
【GCN多模态RS】《Pre-training Representations of Multi-modal Multi-query E-commerce Search》 KDD 2022
Solved files' name is invalid or doors not exist (1205)
剑指 Offer 22. 链表中倒数第k个节点
[comparative learning] understanding the behavior of contractual loss (CVPR '21)
There is no sound output problem in the headphone jack on the front panel of MSI motherboard [solved]
brpc源码解析(四)—— Bthread机制
Transformer变体(Sparse Transformer,Longformer,Switch Transformer)
苹果供应链十年浮沉:洋班主任和它的中国学生们
和特朗普吃了顿饭后写下了这篇文章
对比学习的应用(LCGNN,VideoMoCo,GraphCL,XMC-GAN)