C++作业

课堂作业

#include<iostream>
using namespace std;
int main()
{
  int n;
  while(true)
  {
  	   int a1=n/8;
  	   int a2=n/8/8;
  	   int a=a2/8;
	   if(n%8==1&&a%8==1&&a2%8==7&&n%17==4&&n/17%17==15&&n/17/17==a*2)
  	   {
  	   	   cout<<n;
  	   	   break;
  	   }
  	   
  	   n++;
  	   
  }
  
    return 0;
}

家庭作业

爱因斯坦的数学题

#include<iostream>
using namespace std;
int main()
{
    int o=1;
    int l=o/8;
    int l2=o/8/8;
    int a=l2/8;
    while(true)
    {
        
    
        if(o%2==1&&o%3==2&&o%5==4&&o%6==5&&o%7==0)
        {
            cout<<o;
            break;
        }
        o++;
    
    }
    return 0;
}

角谷猜想

#include<iostream>
using namespace std;
int main()
{
    int p,l;
    cin>>p;
    l=0;
    while(true)
    {
        if(p%2==0)
        {
            p=p/2;
            l++;
        }
        else
        {
            p=p*3+1;
            l++;
        }
        if(p==1)
        {
            break;
        }
    }
    cout<<l;
    return 0;
}

求恰好使s=1+1/2+1/3+...1/n的值大于X时n的值

#include<iostream>
using namespace std;
int main()
{
    int P;
    bouble n=1;
    bouble sum=0;
    cin>>P;
    while(n)
    {
        sum=1.0*n;
        if(sum<P) 
        {
            break;
        }
        n++;
    }
    cout<<n;
    return 0;
}

游泳

#include<iostream>
using namespace std;
int main()
{
    float l,s=2,a=2;
    int i=1;
    cin>>l;
    while(s<l)
    {
        sum=s+a;
        a=a*0.98;
        i++;
    }
    cout<<i;
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值