文章
15
粉丝
0
获赞
8
访问
1.7k
#include<iostream>
#include<cmath>
using namespace std;
int main(){
long long int n;
cin >> n;
if(n == 1){
cout << 1;//判断特殊情况直接输出
return 0;
}
long long int temp = n;
bool first = true; //看看是不是第一个式子
int count = 0;
//先把2这个搞了
while(temp % 2 == 0){
count++;
temp /= 2;
}
if(count == 1){
cout << "2";
first = false;
} else if(count > 1){
cout << "2^" << count;
first = false;
}
//为什么可以直接这样,因为如果3除完了,9也除不了,循环会直接过掉,步长为2是因为除了2,3,没有相邻的素数了捏
for(long ...
登录后发布评论
暂无评论,来抢沙发