HDU 6330--Visual Cube(构造,计算)】的更多相关文章

Visual Cube 将这个立方体分块,分成上中下三个部分,利用长宽高计算行列,最后输出即可. 每个部分都分成奇偶行来输出,总共有\(2*(b+c)+1\)行,共\(2*(a+b)+1\)列.设当前行为\(i\),划分方式:当行数小于等于\(2*b\)时,在上部,当$i > (2 * b) $ && \(i<=2*c+1\)时,在中部,其余在下部.这样的划分可以应对绝大部分情况,但是对于上部有一中情况是不包括的,当$b>c $时,如果继续之前的划分,那么在头部判定之后,…
Problem L. Visual Cube Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 2127    Accepted Submission(s): 984 Problem Description Little Q likes solving math problems very much. Unluckily, howeve…
6330.Problem L. Visual Cube 这个题就是输出立方体.当时写完怎么都不过,后来输出b<c的情况,发现这里写挫了,判断失误.加了点东西就过了,mdzz... 代码: //1012-模拟乱写输出立方体 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<cstdlib&g…
  //题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6330//题目大意:按照一定格式画出一个 a×b×c 的长方体.  #include <bits/stdc++.h> using namespace std; ][]; int main() { int T; scanf("%d",&T); while(T--) { int a,b,c; scanf("%d%d%d",&a,&b…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6330 题目: 题意:给你长宽高,让你画出一个正方体. 思路:模拟即可,湘潭邀请赛热身赛原题,不过比那个容易很多,湘潭那个没写==,这个模拟还是很难受的,写了好久…… 代码实现如下: #include <set> #include <map> #include <queue> #include <stack> #include <cmath> #inc…
Binary Tree 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5573 Description The Old Frog King lives on the root of an infinite tree. According to the law, each node should connect to exactly two nodes on the next level, forming a full binary tree. S…
http://acm.hdu.edu.cn/showproblem.php?pid=5015 由于是个二维的递推式,当时没有想到能够这样构造矩阵.从列上看,当前这一列都是由前一列递推得到.依据这一点来构造矩阵.令b[i]代表第i列,是一个(n+2)*1的矩阵,即b[1] = [1,233......],之所以在加了两行,是要从前一个矩阵b[i-1]得到b[i]中的第二个数2333...,再构造一个转换矩阵a,它是一个(n+2)*(n+2)的矩阵,那么a^(m-1) * b就是第m列. /* a矩…
Elegant Construction 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5813 Description Being an ACMer requires knowledge in many fields, because problems in this contest may use physics, biology, and even musicology as background. And now in this prob…
Pocket Cube 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5292 Description Pocket Cube is the 2×2×2 equivalent of a Rubik's Cube(3×3×3). The cube consists of 8 pieces, all corners. (from wiki) It was a Pocket Cube. Unfortunately, the Cube fell to t…
输入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为中心向外面扩展,进行…