SGU497Abelian Groups

Andrew has just made a breakthrough in group theory: he realized that he can classify all finite Abelian groups (not much of a breakthrough, indeed). Given  n, how many Abelian groups with  n elements exist up to isomorphism? To help you solve this problem we provide some definitions and theorems from basic algebra (most are cited from Wikipedia). An abelian group is a set,  A, together with an operation '·' that combines any two elements  a and  b to form another element denoted  a · b. The symbol '·' is a general placeholder for a concretely given operation. To qualify as an abelian group, the set and operation, ( A, ·), must satisfy five requirements known as the abelian group axioms:
  • Closure: for all ab in A, the result of the operation a · b is also in A.
  • Associativity: for all ab and c in A, the equation (a · b) · c = a · (b · c) holds.
  • Identity element: there exists an element e in A, such that for all elements a in A, the equation e · a = a · e = a holds.
  • Inverse element: for each a in A, there exists an element b in A such that a · b = b · a = e, where e is the identity element.
  • Commutativity: for all ab in Aa · b = b · a.
An example of an abelian group is a  cyclic group of order  n: the set is integers between 0 and  n-1, and the operation is sum modulo  n. Given two abelian groups  Gand  H, their  direct sum is a group where each element is a pair ( gh) with  g from  G and  h from  H, and operations are performed on each element of the pair independently. Two groups  G and  H are  isomorphic when there exists a one-to-one mapping  f from elements of  G to elements of  H such that  f( a) ·  f( b) =  f( a ·  b) for all  a and  b. The  fundamental theorem of finite abelian groups states that every finite abelian group is isomorphic to a direct sum of several cyclic groups. The Chinese remainder theorem states that when  m and  n are coprime, a cyclic group of order  mn is isomorphic to the direct sum of the cyclic group of order  m and the cyclic group of order  n

Input

First and only line of the input file contains an integer  n, 1 ≤  n ≤ 10 12

Output

In the only line of the output file write the number of abelian groups with  n elements. 

Sample Input

Example(s)
sample input
sample output
5
1


数学题:

http://mathworld.wolfram.com/AbelianGroup.html

英文慢慢看吧。。。看完这个AC好爽!!!!!!!

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;
const int maxn = 1000000+10;
vector<long long> prime;
long long dp[200][200];
long long n;
bool vis[maxn];
void getPrime(){
    memset(vis,0,sizeof(vis));
    for(long long  i = 2; i < maxn; i++){
        if(!vis[i]){
            for(long long j = i*i; j < maxn; j+=i){
                vis[j] = 1;
            }
        }
    }
    for(int i = 2; i < maxn; i++){
        if(!vis[i])
            prime.push_back(i);
    }
}
void init(){
    for(int i = 1; i < 100; i++){
        for(int j = 1; j < 100; j++){
           	if(i==1||j==1){
           		dp[i][j] = 1;
           	}
			else if(i<j){
				dp[i][j] = dp[i][i];
			}
			else if(i==j){
				dp[i][j] = dp[i][j-1]+1;
			}else{
				dp[i][j] = dp[i][j-1]+dp[i-j][j];
			}
        }
    }
}
void solve(){
	int i=0;
	long long ans = 1;
	while(n!=1&&i<prime.size()){
		long long t = 0;
		if(n%prime[i]==0){
			while(n%prime[i]==0){
				t++;
				n/=prime[i];
			}
		}
		else i++;
		if(t!=0)
			ans *= dp[t][t];
	}
	if(ans == 0)
		ans = 1;
	cout<<ans<<endl;
}
int main(){
    getPrime();
    init();
    while(~scanf("%lld",&n)){
        solve();
    }
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值