8.18晚
This commit is contained in:
parent
ec01eb6a32
commit
a455799695
12
8.16/M-PairsFormingLCM/Readme.md
Normal file
12
8.16/M-PairsFormingLCM/Readme.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# 题目
|
||||||
|
* 链接
|
||||||
|
### 题意
|
||||||
|
|
||||||
|
### 做法
|
||||||
|
|
||||||
|
### 关键词
|
||||||
|
|
||||||
|
### 易错点
|
||||||
|
*
|
||||||
|
### 工具箱
|
||||||
|
*
|
1
8.16/M-PairsFormingLCM/doc/Readme.md
Normal file
1
8.16/M-PairsFormingLCM/doc/Readme.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
#
|
65
8.16/M-PairsFormingLCM/main.cpp
Normal file
65
8.16/M-PairsFormingLCM/main.cpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
|
using namespace std;
|
||||||
|
const int N=1e7+5,M=7e5+5;
|
||||||
|
int pr[M];//´æÖÊÊý
|
||||||
|
bool b[N];//ÊDz»ÊÇÖÊÊý
|
||||||
|
int cnt=0;
|
||||||
|
inline void prime()
|
||||||
|
{
|
||||||
|
for(int i=2;i<N;i++)
|
||||||
|
{
|
||||||
|
if(!b[i])
|
||||||
|
{
|
||||||
|
pr[++cnt]=i;
|
||||||
|
}
|
||||||
|
for(int j=1;j<=cnt&&pr[j]*i<N;j++)
|
||||||
|
{
|
||||||
|
b[pr[j]*i]=1;
|
||||||
|
if(i%pr[j]==0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int t;
|
||||||
|
int t1 = 0;
|
||||||
|
long long n;
|
||||||
|
int len;
|
||||||
|
int now;
|
||||||
|
int ans;
|
||||||
|
prime();
|
||||||
|
scanf("%d", &t);
|
||||||
|
while (t--)
|
||||||
|
{
|
||||||
|
ans = 1;
|
||||||
|
scanf("%lld", &n);
|
||||||
|
len = sqrt(n);
|
||||||
|
for (int i = 1; pr[i] <= len&&pr[i]; i++)//re
|
||||||
|
{
|
||||||
|
|
||||||
|
if (n % pr[i] == 0)
|
||||||
|
{
|
||||||
|
now = 0;
|
||||||
|
while (n % pr[i] == 0)
|
||||||
|
{
|
||||||
|
n /= pr[i];
|
||||||
|
now++;
|
||||||
|
}
|
||||||
|
ans *= (2*now+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (n > 1)
|
||||||
|
{
|
||||||
|
ans *= 3;
|
||||||
|
}
|
||||||
|
ans=ans/2+1;
|
||||||
|
printf("Case %d: %d\n", ++t1, ans);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
0
8.16/M-PairsFormingLCM/test/in.txt
Normal file
0
8.16/M-PairsFormingLCM/test/in.txt
Normal file
16
8.16/M-PairsFormingLCM/test/in2.txt
Normal file
16
8.16/M-PairsFormingLCM/test/in2.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
15
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
6
|
||||||
|
8
|
||||||
|
10
|
||||||
|
12
|
||||||
|
15
|
||||||
|
18
|
||||||
|
20
|
||||||
|
21
|
||||||
|
24
|
||||||
|
25
|
||||||
|
27
|
||||||
|
29
|
0
8.16/M-PairsFormingLCM/test/in3.txt
Normal file
0
8.16/M-PairsFormingLCM/test/in3.txt
Normal file
7
8.16/M-PairsFormingLCM/test/out.txt
Normal file
7
8.16/M-PairsFormingLCM/test/out.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## z:\Chao\src\Template\test\in.txt
|
||||||
|
2020/03/14 ÖÜÁù 11:41:28.68
|
||||||
|
Hello Easy C++ project!
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Process exited after 200 ms with return value 0
|
||||||
|
|
@ -17,7 +17,7 @@ int main()
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
printf("Case %d: %d",++t1,n);
|
printf("Case %d: %d\n",++t1,n);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user