哪错了
2026-09-18 21:20:35
发布于:湖北
12阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main() {
double a,b,c;
cin>>a>>b>>c;
int cnt=2;
double d=sqrt(a*a+b*b);
if(a>c){ cout<<1; return 0;}
if(b>c){cout<<2; return 0;}
while(d<=c){
d=sqrt(a*a+b*b);
a=b;
b=d;
cnt++;
}
cout<<cnt;
return 0;
}
| ✅ | ❌ |
|---|---|
| 80 | 20 |
全部评论 2
#include <bits/stdc++.h>
using namespace std;int main() {
double a,b,c;
cin>>a>>b>>c;
int cnt=3;
double d=sqrt(aa+bb);
if(a>c){ cout<<1; return 0;}
if(b>c){cout<<2; return 0;}
while(sqrt(aa+bb)<=c){
d=sqrt(aa+bb);
a=b;
b=d;
cnt++;
}
cout<<cnt;
return 0;
}2天前 来自 湖北
0while(sqrt(aa+bb)<=c){ // 或先算 d 再用 d<=c 判断
d=sqrt(aa+bb);
a=b;
b=d;
cnt++;
}
为啥这样写2天前 来自 湖北
0




有帮助,赞一个