我不理解
查看原帖
我不理解
797464
zfw100楼主2023/1/7 19:37

为什么输入100会没结果???(虽然AC了)

#include<bits/stdc++.h>
using namespace std;

int main(){
	double s;
	int num=1;
	cin>>s;
	double first=2;
	for(long long i=0;;num++){
		first=2*pow(0.98,num)+first;
		i++;
		if(first>=s){
			cout<<i+1;
			break;
		}
		
	}
}

2023/1/7 19:37
加载中...