意义不明的打表
2024-12-19 22:43:31
发布于:广东
输入一个 的 矩阵,试试结果
#include <iostream>
#include <cstdio>
using namespace std;
char c[8][8];
unsigned long long ans[]{577094088726155265ull, 1153493525606703105ull, 292736725095563265ull, 297246382237958145ull, 1170937021957408770ull, 585608706247364610ull, 297378317328191490ull, 1154188177435598850ull, 1170944703579824130ull, 576760369759141890ull, 297246377942990850ull, 594492760197726210ull, 2308097558079078660ull, 2308165184214142980ull, 90080928227004420ull, 2341874039636627460ull, 2306476332348870660ull, 594476800348921860ull, 1188959103087681540ull, 612490718627373060ull, 162147728544505860ull, 90090134523355140ull, 148689190832316420ull, 577094139745673220ull, 1170937037029646340ull, 2308095979406114820ull, 1153211915263164420ull, 1153519644301623300ull, 2307039288603181320ull, 162134124219334920ull, 4612813157433344520ull, 1153343854582170120ull, 76702068663910920ull, 297378317462405640ull, 2306970283786895880ull, 4616194020941496840ull, 4612952664681029640ull, 1154048778945175560ull, 148689160817877000ull, 297239845296750600ull, 2306142087114145800ull, 9224499173746819080ull, 180179173830049800ull, 1170938239645745160ull, 297240049576149000ull, 2306476332274450440ull, 306247523977658640ull, 2307039286597255440ull, 577094088726151440ull, 4611972441743819280ull, 81205549035160080ull, 324268244160479760ull, 2307039312249618960ull, 4613940567557080080ull, 585608698710262800ull, 153123761862738960ull, 146402722084634640ull, 297378321619042320ull, 2306970558522343440ull, 9225624953896976400ull, 612490666550902800ull, 153263142016139280ull, 4612284169950101520ull, 297240049324949520ull, 594480098649833760ull, 612507158709273120ull, 292874747648148000ull, 577164509538485280ull, 1170938138646873120ull, 4613940088131355680ull, 9223943788270978080ull, 4612257770917332000ull, 1153343751469401120ull, 576760369259742240ull, 1153625196482004000ull, 306247523708766240ull, 288582290739693600ull, 9223952596195084320ull, 292736724579125280ull, 292804348952608800ull, 1153493390239990080ull, 2306987051079696960ull, 1188959102083007040ull, 577041844735640640ull, 585469119831213120ull, 2306970558656546880ull, 1154048643611887680ull, 577164577201197120ull, 2306986776201790080ull, 2308165182134682240ull, 594492752125822080ull, 1170938239645714560ull};
int main(){
cin.tie(nullptr) -> sync_with_stdio(0);
cout.tie(nullptr) -> sync_with_stdio(0);
unsigned long long tmp = 0;
for(int i = 0; i < 8; i++){
cin >> c[i];
for(int j = 0; j < 8; j++){
if(c[i][j] == 'Q') tmp ^= (1ull << (i * 8 + j));
}
}
int ct = 0;
for(unsigned long long i:ans){
ct += ((i & tmp) == tmp);
}
cout << ct;
return 0;
}
全部评论 1
顶
2024-12-19 来自 广东
0
有帮助,赞一个