top1编程
← 返回题目
题解

【入门】小明学游泳

1 条题解

  • 0
    @ 2026-7-28 22:09:26
    #include <iostream>
    using namespace std;
    
    int main(){
    	int c = 1;	
    	double t = 2,s = 2,x;
    	cin>>x;
    	while(s < x){
    		t = t * 0.98;
    		s = s + t;
    		c++;
    	}
    	
    	cout<<c<<endl;
    }
    
    • 1