CSUOJ 1525 Algebraic Teamwork
Problem A
Algebraic Teamwork
The great pioneers of group theory and linear algebra want to cooperate and join their theories. In group theory, permutations – also known as bijective functions – play an important role. For a finite set A, a function σ : A → A is called a permutation of A if and only if there is some function ρ : A → A with σ(ρ(a)) = a and ρ(σ(a)) = a for all a ∈ A.
The other half of the new team – the experts on linear algebra – deal a lot with idempotent functions. They appear as projections when computing shadows in 3D games or as closure operators like the transitive closure, just to name a few examples. A function p : A → A is called idempotent if and only if p(p(a)) = p(a) for all a ∈ A.
To continue with their joined research, they need your help. The team is interested in non-idempotent permutations of a given finite set A. As a first step, they discovered that the result only depends on the set’s size. For a concrete size 1 ≤ n ≤ 105, they want you to compute the number of permutations on a set of cardinality n that are not idempotent.
Input
The input starts with the number t ≤ 100 of test cases. Then t lines follow, each containing the set’s size 1 ≤ n ≤ 105.
Output
Output one line for every test case containing the number modulo 1000000007 = (109 + 7) of non-idempotent permutations on a set of cardinality n.
Sample Input |
Sample Output |
3 1 2 2171 |
0 1 6425 |
解题:n!-1
1 #include <bits/stdc++.h> 2 #define LL long long 3 using namespace std; 4 const int maxn = 100010; 5 const int md = 1e9+7; 6 LL d[maxn]; 7 int main(){ 8 d[0] = 1; 9 for(int i = 1; i < maxn; ++i) 10 d[i] = (i%md*d[i-1])%md; 11 int x,ks; 12 scanf("%d",&ks); 13 while(ks--){ 14 scanf("%d",&x); 15 printf("%lld\n",(d[x]+md-1)%md); 16 } 17 return 0; 18 }
View Code
转载于:https://www.cnblogs.com/crackpotisback/p/4344895.html
CSUOJ 1525 Algebraic Teamwork相关推荐
- csu 1525: Algebraic Teamwork
1.permutation应该翻译成置换 2. idempotent function:集合A中的每个元素的对应自己本身的映射 3.集合A有n个元素,那么non-idemponent permutat ...
- Algebraic Teamwork
Description Input Output Sample Input 3 1 2 2171 Sample Output 0 1 6425 HINT 1.permutation应该翻译成置换 ...
- 九度OJ 1525 子串逆序打印 -- 2012年Google校园招聘笔试题目
题目地址:http://ac.jobdu.com/problem.php?pid=1525 题目描述: 小明手中有很多字符串卡片,每个字符串中都包含有多个连续的空格,而且这些卡片在印刷的过程中将字符串 ...
- HD 1525 Euclid's Game
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1525 Problem Description Two players, Stan and Ollie, ...
- 统计插件_CG Teamwork统计提交量插件制作思路
每周大家需要统计自己的提交的镜头数以及通过数.有时候统计不及时,就会占用周末玩耍的时间.于是就尝试去写自动统计插件. 公司使用的管理软件是CG Teamwork,翻阅CG Teamwork帮助发现有A ...
- hdu 1525 Euclid‘s Game
hdu 1525 文章目录 Problem Description 题意: 题解: 代码: Problem Description Two players, Stan and Ollie, play, ...
- HDU 1525 类Bash博弈
给两数a,b,大的数b = b - a*k,a*k为不大于b的数,重复过程,直到一个数为0时,此时当前操作人胜. 可以发现如果每次b=b%a,那么GCD的步数决定了先手后手谁胜,而每次GCD的一步过程 ...
- Scrum And Teamwork
Scrum Learning 概念 Scrum是迭代式增量软件开发过程,通常用于敏捷软件开发.Scrum包括了一系列实践和预定义角色的过程骨架.Scrum中的主要角色包括同项目经理类似的Scrum主管 ...
- 用Go构建Teamwork项目的9条教训
我们爱 Go. 在过去的一年中,我们为了构建 Teamwork Desk 多个服务,写下了将近 20 万行 Go 代码.我们已经构建了该产品的十多个小型 HTTP 服务. 为什么要使用 Go? Go ...
最新文章
- c语言 迷宫深度遍历 算法,图的遍历迷宫生成算法浅析
- 通过练习题学习磁盘知识
- Spring AOP注解方式实现
- Tomcat 的 DefaultServlet
- 局部特征检测器和描述符
- mysql不显示默认密码_免安装版mysql不出现默认密码状况(基于mysql8.0)
- python实现的个人税后工资计算器
- .net EventHandler 事件处理
- RedHat Enterprise Linux 4的新安全机制-SELinux
- RNA 3. SCI 文章中基于TCGA 差异表达基因之 DESeq2
- 解释:什么是木马、蠕虫、病毒
- spss进行相关性分析
- TestCenter测试管理工具问题详解(5)
- 人工智能 行为主义 综述
- iOS常用第三方集合(六)
- 【开源库分享】雷电模拟器自动化操作库 C#版本
- 野人岛4四季神器java,生存战争野人岛mod
- TensorFlow实现CGAN
- JS-打开新窗口(window.open)/关闭窗口(window.close)
- 是不是安装了anaconda就不用安装python呢_dnf魔界是怎么样的,今天来带大家见识一下...
热门文章
- ndarray.shape[]返回值的意义
- oracle存储过程 调用java_Oracle存储过程调用Java方法
- java.io包有哪些方法_java.io包下常用类及常用方法介绍
- 16进制数组转成10进制 qt_计算机组成原理(进制数及转换)
- idea spring 中没有标识_Spring 优雅的国际化实现
- ssms没有弹出服务器验证_Nginx服务器负载均衡及生成ssl密钥对、Nginx配置ssl操作示例...
- EVC4.0+AdoCe3.1访问Access数据库全攻略(附带说明及例程)
- java spring maven pdf 导出
- svn提交及更新时的常见问题
- C#后台获取数据库数据--ADO.NET