gpt4 book ai didi

c++ - hangover spoj,解决方案有什么问题?

转载 作者:行者123 更新时间:2023-11-28 06:19:13 26 4
gpt4 key购买 nike

输入

输入由一个或多个测试用例组成,后跟一行包含数字 0.00 的行,表示输入结束。每个测试用例都是一行,包含一个正 float c,其值至少为 0.01,最多为 5.20; c 将恰好包含三个数字。

输出

对于每个测试用例,输出实现至少 c 卡长度的悬垂所需的最少卡数。使用示例中显示的确切输出格式。

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
float num;
cin>>num;
round(num);
cout<<"0.00"<<endl;
float temp = 0.00;
float n=2.00;
int count1=0;

while(temp<num)
{
temp+=1.0/(n);
n++;
count1++;
}
cout<<count1<<" card(s)"<<endl;
return 0;
}

最佳答案

The input consists of one or more test cases...

您的代码不适用于“more”。

关于c++ - hangover spoj,解决方案有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29602274/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com