zoj2027TravellingFee(最短路变形)
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.
SampleInput Outputfor Sample Input
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个;
<strong>[cpp]</strong> view plaincopy


-
#include <iostream></iostream>
登录后复制 -
#include <cstdio></cstdio>
登录后复制 -
#include <cstring></cstring>
登录后复制 -
#include <cmath></cmath>
登录后复制 -
#include <algorithm></algorithm>
登录后复制 -
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\n", polya());
登录后复制 -
}
登录后复制登录后复制登录后复制登录后复制登录后复制登录后复制登录后复制 -
return 0;
登录后复制 -
}
登录后复制登录后复制登录后复制登录后复制登录后复制登录后复制登录后复制

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

本文讨论了使用MySQL的Alter Table语句修改表,包括添加/删除列,重命名表/列以及更改列数据类型。

文章讨论了为MySQL配置SSL/TLS加密,包括证书生成和验证。主要问题是使用自签名证书的安全含义。[角色计数:159]

文章讨论了流行的MySQL GUI工具,例如MySQL Workbench和PhpMyAdmin,比较了它们对初学者和高级用户的功能和适合性。[159个字符]

本文讨论了使用Drop Table语句在MySQL中放下表,并强调了预防措施和风险。它强调,没有备份,该动作是不可逆转的,详细介绍了恢复方法和潜在的生产环境危害。

本文讨论了在PostgreSQL,MySQL和MongoDB等各个数据库中的JSON列上创建索引,以增强查询性能。它解释了索引特定的JSON路径的语法和好处,并列出了支持的数据库系统。

文章讨论了使用准备好的语句,输入验证和强密码策略确保针对SQL注入和蛮力攻击的MySQL。(159个字符)
