发布网友 发布时间:2022-04-14 15:47
共4个回答
懂视网 时间:2022-04-14 20:08
All 6 sides of a cube are to becoated with paint. Each side is is coated uniformly with one color. When a selectionof n different colors of paint is available, how many different cubes can youmake? Note that any two cubes are onlyto be cal
All 6 sides of a cube are to becoated with paint. Each side is is coated uniformly with one color. When a selectionof n different colors of paint is available, how many different cubes can youmake?
Note that any two cubes are onlyto be called "different" if it is not possible to rotate the one intosuch a position that it appears with the same coloring as the other.
Input
Each line of the input filecontains a single integer n(0 Output For each line of input produce oneline of output. This line should contain the number of different cubes that canbe made by using the according number of colors. 1 2 0 1 10 Problem setter: EricSchmidt Special Thanks: DerekKisman, EPS 题意:求用n中颜色涂立方体的不同种数,能旋转到的算一种 题意:和上一题UVA - 10601 Cubes (组合+置换) 的立方体旋转考虑的分类是一样的,不过这里我们考虑的是涂面的情况 1.不变置换(1)(2)(3)(4)(5)(6), 共1个; 2.沿对面中心轴旋转 90度, 270度 (1)(2345)(6), (1)(5432)(6) 同类共 6个; 3.沿对面中心轴旋转 180度 (1)(24)(35)(6), 同类共 3个; 4.沿对角线轴旋转 120度, 240度 (152)(346), (251)(643) 同类共 8个; 5.沿对边中点轴旋转 180度 (16)(25)(43) 同类共 6个;
热心网友
时间:2022-04-14 17:16
热心网友
时间:2022-04-14 18:34
热心网友
时间:2022-04-14 20:09
SampleInput Outputfor Sample Input
[cpp] view plaincopy
#include
#include
#include
#include
#include
typedef long long ll;
using namespace std;
ll n;
ll still() {
return n * n * n * n * n * n;
}
ll point() {
return 4 * 2 * n * n;
}
ll edge() {
return 6 * n * n * n;
}
ll plane() {
return 3 * 2 * n * n * n + 3 * n * n * n * n;
}
ll polya() {
ll ans = 0;
ans += still();
ans += point();
ans += edge();
ans += plane();
return ans / 24;
}
int main() {
while (scanf("%lld", &n) != EOF && n) {
printf("%lld
", polya());
}
return 0;
}
#include <algorithm>
using namespace std;
int cmp(const int &a, const int &b)
{
return a < b;
}
int main()
{
int a,i,j,cu[100010];
while(cin>>a)
{
for(i=0;i<a;i++)
{
cin>>cu[i];
}
sort(cu, cu+a, cmp);
for(i=0;i<a-1;i++)
{
cout<<cu[i]<<' ';
}
cout<<cu[a-1]<<endl;
}
return 0;
}
#include <iostream>
#include <vector>
#include <algorithm>
using std::cin;
using std::cout;
using std::vector;
using std::endl;
int main()
{
vector<int> vi;
unsigned int sz;
cout<<"输入排序数目:"<<endl;
cin>>sz;
cout<<"输入数组:"<<endl;
int i;
while(cin>>i) vi.push_back(i);
std::sort(vi.begin(),vi.begin()+sz);
cout<<"排序完毕:"<<endl;
for(std::vector<int>::const_iterator it=vi.begin(); it!=vi.end(); ++it) cout<<*it<<endl;
return 0;
}
这个有问题,你没有退出的条件。
可以不用这个while的