题解:P11747 「TPOI-1A」鞋子特大号
shexiaopeng · · 题解
洛谷P11747
对于这道题,分为第
#include<bits/stdc++.h>
using namespace std;
int main(){
int T;
cin>>T;//询问个数
while(T--){
int op,x;
cin>>op>>x;//输入
if(op==1){//第一种情况
if(x==1){//特判
cout<<0<<endl;
continue;//跳过
}
int sum=0;
for(int i=2;i*i<=x;i++){
while(x%i==0){//若x能被i整除
sum++;//操作次数增加1
x/=i;
}
}
if(x>1)sum++;
cout<<sum-1<<endl;//输出
}
if(op==2){//第二种情况
unsigned long long pow_2=2;//统计
for(int i=1;i<=x;i++){
pow_2*=2;
}
cout<<pow_2<<endl;//输出
}
}
while(1);//防抄袭
return 0;
}