UVA 253
来源:互联网 发布:老挝嫖尸妓院图片知乎 编辑:程序博客网 时间:2024/05/17 07:26
题目大意:两个正方体,前六个字符代表第一个正方体按图中的编号,进行涂色。后六个字符代表第二个正方体按图中的编号,进行涂色。问能不考虑编号,第一个和第二个正方体是否一样。
解题思路:题目给的编号太麻烦不好判断,将编号顺序改为对面为一对。123456的编号改为162534。排序后判断两个编号是否一致。
ac代码:
#include <iostream>#include <algorithm>using namespace std;char ch[20], t1, t2;int jud;struct node{char a;char b;}no[6];bool compare(node a, node b){if (a.a != b.a)return a.a<b.a;return a.b < b.b;}void change(int n){for (int i=0; i<6; i+=2){t1 = ch[i+n], t2 = ch[6+n-i-1];if (t1 > t2)no[n/2+i/2].a = t1, no[n/2+i/2].b = t2;elseno[n/2+i/2].a = t2, no[n/2+i/2].b = t1;}}int main(){while (scanf("%s", ch)!=EOF){jud = 1;change(0);change(6);sort(no, no+3, compare);sort(no+3, no+6, compare);for (int i=0; i<3; i++)if (no[i].a != no[i+3].a || no[i].b != no[i+3].b)jud = 0;if (jud)printf("TRUE\n");elseprintf("FALSE\n");}return 0;}
阅读全文
0 0
- uva 253
- uva 253
- UVa 253
- uva--253
- UVa 253
- uva 253
- uva 253
- UVa 253
- UVA 253
- UVa 253 - Cube painting
- Uva 253 - Cube painting
- Uva 253 Cube Painting
- uva 253 Cube painting
- uva 253 - Cube painting
- UVa 253 - Cube painting
- UVA 253 立方体着色
- UVA 253 - Cube painting
- UVA 253 - Cube painting
- 怎样去使用一款免费的ERP
- 阻塞和非阻塞、同步和异步
- 解读:HTTP协议
- InetAddress类概述与实例
- opencv安装包,在mingw,Codeblocks的配置
- UVA 253
- github常见操作和常见错误!错误提示:fatal: remote origin already exists. 【转载】
- getOutputStream() has already been called for this response异常处理
- fileinput上传文件
- UVA 10025
- Python基础入门学习
- ArrayList,LinkedList,Vestor
- 【grunt整合版】30分钟学会使用grunt打包前端代码
- Android odex优化提高首次开机速度