codeforces #78 div2 C
2011-07-24 23:42
176 查看
http://www.codeforces.com/contest/99/problem/C
题意就是问给出了6个颜色(可以相同)涂一个正方体,问能组成多少种不同的情况,注:能旋转的就视为同一种情况
方法:模拟正方体旋转,可以拿一块橡皮试试,例如规定0-前,1-后,2-左,3-右,4-下,5上,依次旋转。
题意就是问给出了6个颜色(可以相同)涂一个正方体,问能组成多少种不同的情况,注:能旋转的就视为同一种情况
方法:模拟正方体旋转,可以拿一块橡皮试试,例如规定0-前,1-后,2-左,3-右,4-下,5上,依次旋转。
#include<iostream> #include<vector> #include<map> #include<stack> #include<algorithm> #include<queue> #include<list> #include<set> #include<string.h> #include<stdlib.h> #include<math.h> #include<stdio.h> #include<ctype.h> #include<iomanip> using namespace std; #define LL long long #define L long #define pi acos(-1) #define N 1100 #define INF 9999999999 #define eps 1e-8 string str[] = { "012345", "041235", "034125", "023415", "104523", "120453", "152043", "145203", "215304", "201534", "230154", "253014" }; bool equal(string a, string b) { for(int i = 0 ; i < 12; i++) { string t1; for(int j = 0; j < 6; j++) t1 += a[ str[i][j] - '0' ]; if( t1 == b ) return true; string rev = str[i]; reverse(rev.begin(), rev.end() ); string t2; for(int j = 0 ; j < 6; j++) t2 += a[ rev[j] - '0']; if( t2 == b ) return true; } return false; } int main() { //freopen("a.txt","r",stdin); string s; while(cin >> s) { sort(s.begin(), s.end()); vector<string> myset; do { bool already = false; for(int i = 0; i < myset.size(); i++) if( equal(s, myset[i] ) ) { already = true; break; } if( !already ) myset.push_back(s);//cout<<s<<endl; }while(next_permutation(s.begin(), s.end())); cout<<myset.size()<<endl; } return 0; }
相关文章推荐
- Codeforces Problemset 98C(#78 div.1 C)
- Codeforces Round #291 (Div. 2) D. R2D2 and Droid Army RMQ问题 ST算法
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) B
- Codeforces Round #360 (Div. 2)
- Codeforces Round #460 (Div. 2) D. Substring(图论,记忆化DFS)
- Codeforces Round #262 (Div. 2) 460B. Little Dima and Equation(枚举)
- Codeforces Round #360 (Div. 2) D. Remainders Game 数学
- Codeforces Round #437 (Div. 1) C - Gotta Go Fast
- Codeforces Round #192 (Div. 1) C. Graph Reconstruction 随机化
- Codeforces Round #373 (Div. 2) E. Sasha and Array
- Codeforces Round #250 (Div. 1) D. The Child and Sequence
- Codeforces Round #233 (Div. 2)
- Codeforces Round #360 (Div. 2) D. Remainders Game(数学)
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)A. Vicious Keyboard
- Codeforces Round #359 (Div. 2)D. Kay and Snowflake【树的重心】
- Codeforces Round #310 (Div. 1) C. Case of Chocolate stl应用
- Codeforces Round #329 (Div. 2)A 字符串处理
- Codeforces Round #194 (Div. 1) / 333B Chips(贪心+代码优化)
- Codeforces Round #243 (Div. 2)——Sereja and Table
- Codeforces Round #360 (Div. 1) A. NP-Hard Problem(二分图染色)