1244-请问一个正整数能够整除几次2
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int a = 0;
int b = 2;
while( b <= n )
{
a=a+1;
b=b+2;
}
cout<<a<<endl;
return 0;
}
1062-求落地次数
#include<iostream>
using namespace std;
int main()
{
int a = 100;
int b = 0;
while(a >= 0.5)
{
a = a/2;
b = b+1;
}
b = b+1;
cout<<b<<endl;
return 0;
}
1254-求车速
#include<iostream>
using namespace std;
int main()
{
int n = 95859;
int n1 = 9589=59;
while(true)
{
int g = n%10;
int w = n/10000%10;
int q = n/1000%10;
int s = n/10%10;
if(w == g && q == s)
{
break
}
n++
}
return 0;
}
1961-韩信点兵
#include<iostream>
using namespace std;
int main()
{
int n = 1;
while(true)
{
if(n%5==1 && n%==5 && n%7==4 && n%11==10)
{
cout<<n<<endl;
break;
}
n++
}
return 0;
}
1241-角谷猜想
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int cnt = 0;
while(n!=1)
{
if(n%2==0)
{
n=n/2;
}
else
{
n = n*3+1;
}
cnt++;
}
cout<<cnt<<endl;
return 0;
}