@[15093432132cqt](/user/1010865) 第六行,小于等于n
by LonginusMonkey @ 2023-07-13 14:20:14
@[15093432132cqt](/user/1010865) 一般超时考虑边界
by LonginusMonkey @ 2023-07-13 14:21:16
@[Half_Monkey](/user/326254)
谢谢
by 15093432132cqt @ 2023-07-13 14:21:39
@[Half_Monkey](/user/326254)
为啥输出0??
```cpp
#include <bits/stdc++.h>
using namespace std;
double n,sum=0,jl=0;
void shi_jian(int x){
if(jl<=n){
return;
}
sum++;
jl+=x*sum;
shi_jian(x*=0.98);
}
int main(){
cin>>n;
shi_jian(2);
cout<<sum;
}
```
by 15093432132cqt @ 2023-07-13 14:24:06
@[15093432132cqt](/user/1010865) 第五行int改double,太粗心了可不行
by LonginusMonkey @ 2023-07-13 14:25:50
应该是大于等于吧,而且jl+=x就行了
by iBaeJuhyun @ 2023-07-13 14:27:47
```cpp
#include<bits/stdc++.h>
using namespace std;
double n,jl=0;
int sum=0;
void shi_jian(double x){
if(jl>=n) return ;
sum++;
jl+=x;
shi_jian(x*0.98);
}
int main(){
cin>>n;
shi_jian(2.0);
cout<<sum;
return 0;
}
```
by Discorder_ @ 2023-07-13 14:29:34
谢谢各位
by 15093432132cqt @ 2023-07-13 14:49:04
```cpp
#include<bits/stdc++.h>
using namespace std;
int sum;
double s=2.0,T;
void mai(double &a,int &b){
b++;
a*=0.98;
return;
}
int main(){
cin>>T;
while(T>0){
T-=s;
mai(s,sum);
}
cout<<sum;
return 0;
}
```
@[15093432132cqt](/user/1010865)
by Sci_8633 @ 2024-01-19 19:42:47