标签:.com queue http col ace png fine complex com
怎么来模拟,记录上下左右前后,转的时候轮换比较简单,记两个再推出其它是错的......
1 #include <iostream> 2 #include <cstring> 3 #include <cmath> 4 #include <cstdio> 5 #include <algorithm> 6 #include <queue> 7 #include <vector> 8 #include <map> 9 #include <complex> 10 11 #define inf 0x3f3f3f3f 12 #define MAXN 131072 13 14 using namespace std; 15 16 typedef long long ll; 17 18 ll n, m, ans; 19 ll s, x, z, y, q, h; 20 void soll() { 21 int t = s; 22 s = y, y = x, x = z, z = t; 23 ans += s; 24 } 25 void solr() { 26 int t = s; 27 s = z, z = x, x = y, y = t; 28 ans += s; 29 } 30 void sold() { 31 int t = s; 32 s = h, h = x, x = q, q = t; 33 ans += s; 34 } 35 int main() { 36 ans = s = 1, x = 6, z = 4, y = 3, q = 2, h = 5; 37 scanf("%lld %lld",&n,&m); 38 for(int i = 1; i <= n; i ++){ 39 ans += ((m - 1) / 4) * 14; 40 if(i & 1) 41 for(int j = 1; j <= (m - 1) % 4; j ++) solr(); 42 else 43 for(int j = 1; j <= (m - 1) % 4; j ++) soll(); 44 if(i != n) sold(); 45 } 46 printf("%lld\n", ans); 47 return 0; 48 }
标签:.com queue http col ace png fine complex com
原文地址:https://www.cnblogs.com/lcan/p/9534751.html