#include<bits/stdc++.h>
using namespace std;intmain(){int n, cnt =0;
cin >> n;while(n%2==0){
cnt ++;
n /=2;}
cout << cnt;return0;}
分数求和
#include<bits/stdc++.h>
using namespace std;intmain(){int n;double ans =0;
cin >> n;for(int i =1; i <= n; i ++){if(i%2==1) ans +=1.0/ i;else ans -=1.0/ i;}printf("%.1f", ans);return0;}
打印菱形
#include<iostream>
using namespace std;intmain(){int n;
cin >> n;for(int i =1; i < n; i++){for(int j =1; j <= n - i; j++) cout <<' ';
cout <<'O';for(int j =1; j <=2* i -3; j++) cout <<' ';if(i !=1)
cout <<'O';
cout << endl;}for(int i = n; i >=1; i--){for(int j =1; j <= n - i; j++) cout <<' ';
cout <<'O';for(int j =1; j <=2* i -3; j++) cout <<' ';if(i !=1)
cout <<'O';
cout << endl;}return0;}