There are several colored cubes. All of them are of the same size but they may be colored differently. Each face of these cubes has a single color. Colors of distinct faces of a cube may or may not be the same. Two cubes are said to be identically co…
UVA 10733 - The Colored Cubes 题目链接 题意:一个立方体.n种颜色,问能涂成多少不同立方体 思路:Ploya求解,正方体相应24种不同旋转一一计算出循环个数就可以.和 UVA 10601 - Cubes这题类似 代码: #include <stdio.h> #include <string.h> unsigned long long n; int main() { while (~scanf("%llu", &n) &…
Description There are several colored cubes. All of them are of the same size but they may be colored differently. Each face of these cubes has a single color. Colors of distinct faces of a cube may or may not be the same. Two cubes are said to be id…
题意 有一个n*n的棋盘和m个棋子,每个棋子有一个初始位置和一个目标位置,每次移动只能选择一个棋子移动到他相邻的格子,并且花费一秒钟.请你找出一个移动的方法,使得在10800步内将所有棋子移动到目标位置.分析 不是求最少步数!!不是!!题目中保证一定有解,所以很容易想到是构造(场上并没有) 先读入每个棋子的起始位置,然后将第i个棋子移动到(i,i)位置.然后读入每个棋子的终止位置,然后也将其移动到(i,i)位置,然后正着输出第一个方案,倒着输出第二个方案. 然后我们怎么考虑将i个棋子移动到(i,…
Codeforces 题面传送门 & 洛谷题面传送门 一道不算困难的构造,花了一节英语课把它搞出来了,题解简单写写吧( 考虑从大往小加数,显然第三个条件可以被翻译为,每次加入一个元素,如果它所在的行/列存在元素,那么它必须为这一行/列所在的元素相邻,因此我们考虑这样构造,当我们加入一个数 \(v\) 时,分以下几种情况考虑: 如果 \(v\) 在原矩阵中既是行的最大值,也是列的最大值,那我们新开一行一列并将这个元素塞进去.即我们动态维护一个 \(R,C\) 表示目前有 \(R\) 行 \(C\)…
B. Looksery Party time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The Looksery company, consisting of n staff members, is planning another big party. Every employee has his phone number and…
输入n 1 <= n <= 100 有一个n * n * n 的立方体,由n ^ 3 个1 * 1 * 1 的单位立方体构成 要用white 和 black 2种颜色来染这n ^ 3个立方体,要求: 白色的立方体恰好有2个相邻的白色立方体 黑色的立方体恰好有2个相邻的黑色立方体 无解的时候输出-1,有解的时候输出一种染色方案 solution: n为奇数时,无解,输出 -1 n为偶数时,n = 2时的答案: bb    ww bb    ww n > 2时,以n=2为中心向外面扩展,进行…
Problem I. Instruction 题目连接: http://codeforces.com/gym/100531/attachments Description Ingrid is a head of a big railway station and, among other duties, is responsible for routing trains to the right platforms. The station has one entrance, and there…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud System Administrator Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible…
[题目链接] http://codeforces.com/contest/353/problem/D [题目大意] 10^6个男女排队,每一秒,如果男生在女生前面,即pos[i]是男生,pos[i+1]是女生,两人互换位置,求解在多少秒后,队伍不再变化. [题解] 对于前后的两个女生来说,如果后面的女生在前移的过程中会碰到前面的女生,那么它所需要的时间就是前面女生所需要的时间+1,那么从前到后统计,不断更新最大值即可. [代码] #include <cstdio> #include <a…