URAL1049. Brave Balloonists
求约数的个数 质因子数的个数+1相乘
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<cmath>
using namespace std;
#define N 10000
int f[N+],a[],p[N+],g,o[N+];
void init()
{
int i,j;
for(i = ; i <= ; i++)
if(!f[i])
{
for(j = i+i ; j <= N ; j+=i)
f[j] = ;
}
for( i = ; i <= N ;i++)
if(!f[i])
p[++g] = i;
}
int main()
{
int i,j;
init();
for(i = ; i <= ; i++)
cin>>a[i];
for(i = ; i <= ; i++)
{
int x = a[i];
for(j = ; j <= g ; j++)
{
while(x&&x%p[j]==)
{
x/=p[j];
o[p[j]]++;
}
}
}
int ans = ;
for(i = ; i <= g ; i++)
ans = (ans*(o[p[i]]+))%;
cout<<ans<<endl;
return ;
}
URAL1049. Brave Balloonists的更多相关文章
- ural 1049. Brave Balloonists(标准分解式,数论)
1049. Brave Balloonists Time limit: 2.0 secondMemory limit: 64 MB Ten mathematicians are flying on a ...
- HDU 1856 Brave Game(巴什博奕)
十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫<勇敢者的游戏>(英文名称:Zathura),一直到现在,我依然对于电影中的部分电脑特技印象深刻. 今天,大家选择 ...
- HDU 1846 Brave Game(巴什博弈)
题目链接: 传送门 Brave Game Time Limit: 1000MS Memory Limit: 65536K 题目描述 各位勇敢者要玩的第一个游戏是什么呢?很简单,它是这样定义的: ...
- HDU 1846 Brave Game(简单巴什博弈)
Brave Game Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- 10055 - Hashmat the Brave Warrior
Problem A Hashmat the brave warrior Input: standard input Output: standard output Hashmat is a brave ...
- HDU-1846 Brave Game
http://acm.hdu.edu.cn/showproblem.php?pid=1846 (一)巴什博奕(Bash Game):只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最 ...
- HDOJ 1846 Brave Game
Problem Description 十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫<勇敢者的游戏>(英文名称:Zathura),一直到现在,我依然对于电影中 ...
- Hashmat the brave warrior - UVa10055
欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/uva10055.html 题目描述 Pr ...
- hdu 1846 Brave Game 简单博弈
Problem Description 十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫<勇敢者的游戏>(英文名称:Zathura),一直到现在,我依然对于电影中 ...
随机推荐
- shiro添加注解@RequiresPermissions不起作用
这是因为没有开启spring拦截器,在spring-mvc.xml中加入以下代码就可以了(一定要写在最先加载的xml中,写在后面加载的xml中也不起作用) <bean class="o ...
- vs2008 添加与修改模板.
添加 我的模板: 路径: C:\Users\Administrator\Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C# ...
- web服务器与应用服务器
WEB服务器与应用服务器的区别: 1.WEB服务器: 理解WEB服务器,首先你要理解什么是WEB?WEB你可以简单理解为你所看到的HTML页面就是WEB的数据元素,处理这些数据元素的应用软件就叫WEB ...
- Ogre1.8.1源码编译
本文的编译环境为Windows7_SP1 + VS2010_SP1 + CMake2.8.11 :) 资源下载 1. 下载Ogre1.8.1的源代码,下载链接地址:http://www.ogre3 ...
- 你必须知道的ADO.NET
原文:http://www.cnblogs.com/liuhaorain/archive/2012/02/06/2340409.html 1. 什么是ADO.NET? 简单的讲,ADO.NET是一组允 ...
- 取得DisplayMerics手机屏幕大小的应用
DisplayMerics:A structure describing general information about a display, such as its size, density, ...
- UVA 11181 dfs 概率
N friends go to the local super market together. The probability of their buying something from them ...
- Install wxWidgets-3.0.2 on GNU/Linux Debian
转载自 http://www.binarytides.com/install-wxwidgets-ubuntu/ wxWidgets wxWidgets is an application devel ...
- FastJson与Gson小测试
最近用到Json来传输数据,找到两个比较简单的工具 Gson 和 FastJson随便测试一下两个工具的效率~ 1 package com.json.fast; import java.util.Ar ...
- 数论之高次同余方程(Baby Step Giant Step + 拓展BSGS)
什么叫高次同余方程?说白了就是解决这样一个问题: A^x=B(mod C),求最小的x值. baby step giant step算法 题目条件:C是素数(事实上,A与C互质就可以.为什么?在BSG ...