A22581. # include< bits/ stdc++. h> using namespace std; int n; int f1(int n){ int res=0; for(int i=2;1<=n;1+=2){ int j=i; while(j%2==0) res++; j/=2; } return res; } int f2(int n){ int res=0; while(n){ n/=5;…
判断题
较易
知识点
题目描述
# include< bits/ stdc++. h>
using namespace std;
int n;
int f1(int n){
int res=0;
for(int i=2;1<=n;1+=2){
int j=i;
while(j%2==0)
res++;
j/=2;
}
return res;
}
int f2(int n){
int res=0;
while(n){
n/=5;
res+=n;
}
return res;
}
int main(){
cin>>n;
cout<< min(f1(n),f2(n));
return 0;
}保证输入的 n不超过105,完成下面的判断题和单选题:
将第8行的 j%2==0 改为 !(j&1) 程序功能不变。( )
选项(单选)
答案解析
详细答案解析为会员权益,按每日次数查看。
开通 / 升级会员
上一题
下一题