当前位置:网站首页>The point rotates clockwise around the center of the grid by 90 ° 180 ° 270 ° coordinate change
The point rotates clockwise around the center of the grid by 90 ° 180 ° 270 ° coordinate change
2022-07-22 13:09:00 【*Pursuing dreams*】
Record the conclusion directly :s[i][j] ( The coordinates are from 0 At the beginning )
s[j][n - i - 1](90°)
s[n - j - 1][i](270°)
s[n - i - 1][n - j - 1](180°)
Put an example for everyone and myself to understand
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t --)
{
int n;
cin >> n;
string s[n + 10];
for(int i = 0; i < n; i ++)
{
cin >> s[i];
}
int ans = 0;
for(int i = 0; i < n; i ++)
{
for(int j = 0; j < n; j ++)
{
int s0 = 0;
int s1 = 0;
if(s[i][j] == '0') s0 ++;
else s1 ++;
if(s[j][n - i - 1] == '0') s0 ++;
else s1 ++;
if(s[n - j - 1][i] == '0') s0 ++;
else s1 ++;
if(s[n - i - 1][n - j - 1] == '0') s0 ++;
else s1 ++;
ans += min(s1, s0);( Each one finds the corresponding ones , have a look 1 Less or 0 Less , Less )
}
}
cout << ans / 4 ( Because each one has been traversed , So I repeat 3 All over , Divide by 4)<< "\n";
}
}
Make a record of the questions : The foundation is still too unsound , Many things are the first time to see , Start with this question , At first, I thought it was rotation 180°, Later, it was found that the sample was wrong , Only to find that it's not just this , A lot of time was wasted , Start to change again , Then I don't know how to do this , I may not know this conclusion , I hope I can keep this conclusion in mind , It can be used at a critical time in the future .
边栏推荐
- The four trends and three key points of the data platform construction mode are summarized
- The sandbox and tower team jointly launched the tower defense game creation competition
- Wechat hotel reservation applet graduation design (2) applet function
- 档案的逻辑 | 档案分类中的重要概念
- 多重背包笔记
- Why is risc-v architecture gaining momentum
- 2022大健康产业展,山东大健康展会,健康膳食展,特医食品展
- Use response in the requests library Json() error: json decoder. JSONDecodeError: Expecting value
- 并发程序的噩梦——数据竞争
- Concept, architecture and key technologies of industrial Internet
猜你喜欢
Matlab digital image processing homework: facial expression recognition
2022.07.18
新能源_光伏逆变器
OSPF comprehensive experiment
ACL-IJCAI-SIGIR頂級會議論文報告會(AIS 2022)筆記1:推薦系統
2022 audio and video technology vane
Acl-ijcai-sigir top conference paper report meeting (AIS 2022) Note 1: recommendation system
LEGO loam run through and source code learning
The sandbox and tower team jointly launched the tower defense game creation competition
Wechat hotel reservation applet graduation project (4) opening report
随机推荐
Configure SSL certificate for Baidu cloud virtual machine BCH
2022 Shandong Health Exhibition, health industry exhibition, DJK China Health Expo, sleep health exhibition
[ kitex 源码解读 ] Kitex 扩展性设计思路
Aike AI frontier promotion (7.21)
threejs
Application of international standard iso/iec 30144: 2020 in auxiliary monitoring of Intelligent Substation
携手HMS Core分析服务,以数据助力游戏高效增长
Easy gene | how to do the simplified genomic DNA methylation sequencing (RRBs) experiment?
el-input 失去焦点事件
Concept, architecture and key technologies of industrial Internet
Iooutputstream type
华为无线设备配置攻击检测功能
Wechat hotel reservation applet graduation design (2) applet function
eventlet 协程
IOOutputStream类型
inspire people! Metaverse Wealth outlet of next generation Internet
深层递归的优化
Alibaba cloud technology expert Yang Zeqiang: building observable capabilities on elastic computing cloud
Huawei wireless device configuration attack detection function
OAuth2.0