You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include <bits/stdc++.h>
using namespace std ;
// 交换上下两行
string A ( string t ) {
// 1234 5678---> 8765 4321
// 使用瞪眼大法, 发现开始位置与终止位置是关于中线对称的, 即0<->7,1<->6,2<->5,3<->4,这样就简单了, 直接i<->7-i
for ( int i = 0 ; i < 4 ; i + + ) swap ( t [ i ] , t [ 7 - i ] ) ;
return t ;
}
// 将最右边的一列插入到最左边
string B ( string t ) {
// 1234 5678 ---> 4123 6785
// 4向上冒泡,5向后冒泡
for ( int i = 3 ; i > 0 ; i - - ) swap ( t [ i ] , t [ i - 1 ] ) ;
for ( int i = 4 ; i < 7 ; i + + ) swap ( t [ i ] , t [ i + 1 ] ) ;
return t ;
}
// 魔板中央对的4个数作顺时针旋转
string C ( string t ) {
// 1234 5678 ---> 1724 5368
/*
swap(t[1], t[2]) 1234 5678 -> 1324 5678 把第一个不匹配的数字放到合适位置上
swap(t[5], t[6]) 1324 5678 -> 1324 5768 把第二个不匹配的数字放到合适位置上
swap(t[1], t[5]) 1324 5768 -> 1724 5368 回到头,再把第一个不匹配的数字放到合适位置上
*/
swap ( t [ 1 ] , t [ 2 ] ) , swap ( t [ 5 ] , t [ 6 ] ) , swap ( t [ 1 ] , t [ 5 ] ) ;
return t ;
}
int main ( ) {
return 0 ;
}