博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1049. Brave Balloonists
阅读量:6921 次
发布时间:2019-06-27

本文共 2817 字,大约阅读时间需要 9 分钟。

1049. Brave Balloonists

Time limit: 2.0 second Memory limit: 64 MB
Ten mathematicians are flying on a balloon over the Pacific ocean. When they are crossing the equator they decide to celebrate this event and open a bottle of champagne. Unfortunately, the cork makes a hole in the balloon. Hydrogen is leaking out and the balloon is descending now. Soon it will fall into the ocean and all the balloonists will be eaten by hungry sharks.
But not everything is lost yet. One of the balloonists can sacrifice himself jumping out, so that his friends would live a little longer. Only one problem still exists: who is the one to get out. There is a fair way to solve this problem. First, each of them writes an integer
 
ai
 not less than 1 and not more than 10000. Then they calculate the magic number
 
N
 that is the number of positive divisors of the product
 
a
1*
a
2*…*
a
10. For example, the number of positive integer divisors of 6 is 4 (they are 1,2,3,6). The hero (a mathematician who will be thrown out) is determined according to the last digit of
 
N. Your task is to find this digit.

Input

Input contains ten integer numbers (each number is in separate line).

Output

Output a single digit from 0 to 9 — the last digit of
 
N.

Sample

input output
1261311111
9
Problem Author: Stanislav Vasilyev
Problem Source: Ural State University collegiate programming contest (25.03.2000)
***************************************************************************************
求因子的个数=连乘(ai+1);ai为质因子的个数。
***************************************************************************************
1 #include
2 #include
3 #include
4 #include
5 #include
6 using namespace std; 7 int su[10003]; 8 bool p[10003]; 9 int ks,sm;10 int sum[10003];11 void find(int x)12 {13 int m=x;14 m+=x;15 while(m<=10001)16 {17 p[m]=true;18 m+=x;19 }20 }21 void sushu()22 {23 for(int iv=2;iv<=10001;iv++)24 {25 if(!p[iv])26 {27 find(iv);28 su[++ks]=iv;29 }30 31 }32 }33 int main()34 {35 int a;36 ks=0;37 int i,ds;38 memset(p,false,sizeof(p));39 memset(su,0,sizeof(su));40 sushu();41 memset(sum,0,sizeof(sum));42 for(i=1;i<=10;i++)43 {44 cin>>a;45 ds=1;46 while(a>1)47 {48 while(a%su[ds]==0&&a>1&&su[ds]<=a)49 {50 a=a/su[ds];51 ++sum[ds];52 }53 ds++;54 }55 }56 sm=1;57 for(i=1;i<=ks;i++)58 {59 //cout<
<
View Code

 

转载于:https://www.cnblogs.com/sdau--codeants/p/3251031.html

你可能感兴趣的文章
判断回文数、回文字符串(从左边读和从右边读一样)
查看>>
Java的SimpleDateFormat类
查看>>
Oracle系列:(33)JDBC访问Oracle的存储过程和存储函数
查看>>
企业实战(3)-主从实现基于Keepalived高可用集群网站架构
查看>>
一键安装lamp脚本--进阶版
查看>>
ngnix安装与配置
查看>>
maven 管理项目实践指南
查看>>
jqeury数据缓存之data()解析
查看>>
我的友情链接
查看>>
分组计算描述性统计量
查看>>
redhat安装ibm,rdac多路径的奇葩经历
查看>>
【Python之旅】第三篇(二):Pickle序列化
查看>>
移动端keyup事件 ios端 输入框实时变化
查看>>
CSS中选择器权重计算的例题
查看>>
yum提示another app is currently holding the yum lock
查看>>
5款靠谱的安卓备份应用
查看>>
ContentProvider+ContentResolver+ContentObserver
查看>>
ORA-28001: the password has expired解决方法
查看>>
获取不同尺寸3.5/4.0的屏幕大小和系统ios 6/7的版本
查看>>
DOM和IE获取滚动条滚动的距离
查看>>