URAL 1878Rubinchik's Cube 水题
来源:互联网 发布:数据库数据模型有几种 编辑:程序博客网 时间:2024/06/07 20:29
题意:给四种方块,每种方块都可以顺时针和逆时针旋转。
A把很多这四种方块用一根木棍串起来,形成一个图形,求至少需要旋转多少次能达成一个角只有一种颜色。
//author: CHC//First Edit Time:2014-07-18 14:53//Last Edit Time:2014-07-18 14:53#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>using namespace std;int mapp[5][5];int getval(int x,int y){ int cnt=0; for(int i=1;i<=2;i++){ for(int j=1;j<=2;j++){ cnt+=min(abs(mapp[i][j]-mapp[x][y]),4-abs(mapp[i][j]-mapp[x][y])); } } return cnt;}int main(){ while(1){ int flag=0; for(int i=1;i<=4&&flag!=EOF;i++) for(int j=1;j<=4&&flag!=EOF;j++) flag=scanf("%d",&mapp[i][j]); if(flag==EOF)break; int mm=1000; for(int i=1;i<=2;i++){ for(int j=1;j<=2;j++){ int vv=getval(i,j); if(mm>vv)mm=vv; } } printf("%d\n",mm); } return 0;}
0 0
- URAL 1878Rubinchik's Cube 水题
- ural 1878 Rubinchik's Cube
- URAL 1802. Cube Puzzle
- URAL 1876 Centipede's Morning 水题
- hdu3220Alice’s Cube(IDA*)
- HDU3220-Alice’s Cube
- Ivan's Car URAL
- URAL 1880Psych Up's Eigenvalues multiset水题
- HDU 4397 - Rubik's Cube
- HDU 4397 Rubik's Cube
- POJ 1955 Rubik's Cube
- HDU 3220 Alice’s Cube
- ural 1016 Cube on the Walk 状态压缩最短路
- URAL 1016. Cube on the Walk(搜索)比较难
- Ural 1016. Cube on the Walk (bfs滚骰子)
- URAL 1016 Cube on the Walk (SPFA+HASH)
- URAL 1016 Cube on the Walk 搜索题
- Ural 1671. Anansi's Cobweb
- egit链接
- URAL 1877Bicycle Codes 水题
- 归并排序
- java的运行原理
- PHP进阶
- URAL 1878Rubinchik's Cube 水题
- 二分图相关题
- Unity3d网络游戏Socket通讯
- 初识网页设计
- UVA 10689 - Yet another Number Sequence(矩阵快速幂)
- 【技术体系框架】排序算法
- poj 1827 A Bunch Of Monsters
- URAL 1880Psych Up's Eigenvalues multiset水题
- PHP之AOP思想