📄 1015.cpp
字号:
#include <iostream>#include <vector>#include <string>using namespace std;int hash[7][7][7][7];int t[5]; //顺时针顺序void sort_t(){ int i, pos = 1; int t2[5]; memcpy(t2, t, sizeof(t)); for( i = 1; i <=4; i++ ) if( t[i] < t[pos] ) pos = i; for( i = 1; i <= 4; i++ ) t[i] = t2[(pos + i - 1 - 1)%4 + 1 ] ; }int main(){// freopen("1015.in", "r", stdin); vector<vector<int> > a; int n, i, j, g, dice[7]; memset( hash , 0 , sizeof(hash) ); memset( t, 0, sizeof(t) ); cin >> n ; g = 0; for( i = 1; i <= n ; i++ ) { for( j = 1; j <= 6; j++ ) cin >> dice[j]; for( j = 1; j <= 6; j++ ) if( dice[j] == 1 ) { switch(j) { case 1 : t[1] = dice[3], t[2] = dice[4], t[3] = dice[5], t[4] = dice[6]; break; case 2 : t[1] = dice[3], t[2] = dice[6], t[3] = dice[5], t[4] = dice[4]; break; case 3 : t[1] = dice[6], t[2] = dice[2], t[3] = dice[4], t[4] = dice[1]; break; case 4 : t[1] = dice[3], t[2] = dice[2], t[3] = dice[5], t[4] = dice[1]; break; case 5 : t[1] = dice[4], t[2] = dice[2], t[3] = dice[6], t[4] = dice[1]; break; case 6 : t[1] = dice[3], t[2] = dice[1], t[3] = dice[5], t[4] = dice[2]; break; default: cout << "error" << endl; } break; } sort_t();// cout << t12 << ' ' << t3 << ' ' << t6 << ' ' << t9 <<endl; if( hash[ t[1] ][ t[2] ][ t[3] ][ t[4] ] == 0 ) { hash[ t[1] ][ t[2] ][ t[3] ][ t[4] ] = ++g; vector<int> temp; temp.push_back(i); a.push_back( temp ); } else a[ hash[ t[1] ][ t[2] ][ t[3] ][ t[4] ] - 1 ].push_back(i); } cout << g << endl; for( i = 0; i < a.size(); i++ ) { for( j = 0; j < a[i].size(); j++ ) cout << a[i][j] << ' ' ; cout << endl; } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -