2 条题解

  • 6
    @ 2023-3-26 9:40:32
    #include <iostream>
    using namespace std;
    int main()
    {
    		
    	double n = 2, a = 2, x;
    	cin >> x;
    	int cnt = 1;
    	while (a < x)
    	{
    		n *= 0.98;
    		a += n;
    		cnt++;
    	}
    	cout << cnt << endl;
    	return 0;
    } //代码已AC
    
    • 0
      @ 2023-10-14 19:31:51

      先赞后搬

      #include<bits/stdc++.h>
      using namespace std;
      double x,num;
      int main()
      {
          double l=2;
          cin>>x;
          while(x>0)
          {
              num++;
              x-=l;
              l*=0.98;
          }
          cout<<num;
          return 0;
      }
      

      已AC

      • 1

      信息

      ID
      457
      时间
      1000ms
      内存
      32MiB
      难度
      1
      标签
      递交数
      45
      已通过
      36
      上传者