1 条题解

  • 0
    @ 2025-4-11 21:08:27
    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        int k;  //k代表竹笋达到的可以吃的高度
        cin>>k;
    	double h1,h=0; //h1:表示竹笋每天长的高度,h代表竹笋长的总高度
    	//当 h >=k   时候,就代表竹笋可以吃了 
    	h1=0;
        for(int i=1;i<=365 ;i++){
        	h1= 16.0/i  ;
        	h+= h1  ;	
    		//cout<<h1<<"  "<<h<<endl;	   
    		if( h>=k) { //满足条件,可以吃了 
    			cout<<i ;  //输出长了多少天 
    			return 0; //结束 
    		}
    	}
    	cout<<-1  ;
    	return 0;
    }
    
    • 1

    信息

    ID
    108
    时间
    1000ms
    内存
    64MiB
    难度
    8
    标签
    递交数
    181
    已通过
    32
    上传者