6 条题解

  • 1
    @ 2025-3-29 20:43:03
    #include<bits/stdc++.h>
    double x;
    using namespace std;
    int main()
    {
        cin>>x;
        cout<<ceil(log(1-x/100)/log(0.98));
        return 0;
    }
    
    
    • 1
      #include<stdio.h>
      int main()
      {
          float a;
          double b=2;
          double c=2;
          int count=1;
          scanf("%f",&a);
          if(a>=b){
          while(b<=a){
              c=c*0.98;
              b=b+c;
              count++;
          }
          printf("%d",count);
          }else if(a<b){
          printf("1");
          }
          return 0;
      }
      
      • 0
        @ 2025-11-17 16:48:31
        #include<stdio.h>
        int main() {
        	double s,k=0;
        	int n = 0;
        	scanf("%lf", &s);
        	for (; k < s; n++) {
        		k *= 0.98;
        		k += 2;
        	}
        	printf("%d", n);
        	return 0;
        }
        
        • 0
          @ 2025-10-8 13:08:07
          #include<iostream>
          using namespace std;
          int main()
          {int i=1;
          double s=0,a=2,sum=2;
          cin>>s;
          do{if(sum<s)
          {i++;
          a=a*0.98;
          sum+=a;}
          else {cout<<i<<endl;
          return 0;}}
          while (sum<s);
          cout<<i<<endl;
          return 0;}
          
          • 0
            @ 2025-10-4 20:09:57
            #include <bits/stdc++.h>
            using namespace std;
            int main(){
                double d=2,l=0,n=0,s;
                cin>>s;
                while(l<=s){
                    n+=1;
                    l+=d;
                    d*=0.98;
                }
                cout<<n;
            }  
            
            • -2
              @ 2025-3-31 14:10:22

              import java.util.Scanner;

              public class Main {

              public static void main(String[] args) {
                  Scanner sc = new Scanner(System.in);
                  //定义变量接受要游的距离
                  double distance = sc.nextDouble();
              
                  //定义变量接受要游的步数,还有步幅
                  int steps = 0;
                  double stepLength = 2;
              
                  //用while循环来计算步数
                  while (distance > 0) {
                      distance -= stepLength;
                      steps++;
                      stepLength *= 0.98;
                  }
              
                  //输出步数
                  System.out.println(steps);
              }
              

              }

              • 1

              信息

              ID
              5481
              时间
              1000ms
              内存
              125MiB
              难度
              1
              标签
              (无)
              递交数
              602
              已通过
              338
              上传者