//求最大卡片数
//注意精度问题,否则题目会出错
#include <iostream>
using namespace std;
int main()
{
 //使用double类型,如果使用float类型精度不够,会出错
 double data;
 cin>>data;
 while(data!=0.00 && data>=0.01 && data<=5.20)
 {
  double sum=0;
  int n=2;
  while(sum<data)
  {
   sum = sum+1.00/n;
   n++;
  }
  cout<<n-2<<" card(s)"<<endl;
  cin>>data;
 }
 return 0;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-12-28
  • 2022-12-23
  • 2021-09-15
  • 2021-09-08
猜你喜欢
  • 2021-12-29
  • 2021-12-22
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案