3 条题解

  • 1
    @ 2023-8-30 16:40:07

    Python的哦~

    x=int(input())
    y=x
    x1=y
    a=0
    while x*0.001<x1:
        x1=x1*0.7
        if x*0.001<x1:
            y=y+2*x1
    y=round(y,2)
    print(y)
    
    • 1
      @ 2023-1-17 12:06:08
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	double n;
      	cin >> n;
      	double b = n;
      	double S = n;
      	for (int i=1; i <= 99999; i++)
      	{
      		if (pow(0.7,i)*n <= b / 1000)
      			break;
      		else
      		{
      			S = S + 2 * pow(0.7, i) * n;
      			
      		}
      	}
      	printf("%.2f", S);
      }
      
      
      • 1
        @ 2021-5-24 13:43:02

        C++ :

        #include <iostream>
        #include <cstdio>
        #include <cstring>
        #include <stdlib.h>
        using namespace std;
        
        int main()
        {
            double a,sum=0,b;
            scanf("%lf",&a);
            b=a;
            for(int i=0;;i++){
        
                    sum+=b;
                    b*=0.7;
            if(b<(a/1000))break;
                    sum+=b;
        
            }
            printf("%.2lf",sum);
        
            return 0;
        }
        
        
        • 1

        信息

        ID
        114
        时间
        1000ms
        内存
        128MiB
        难度
        3
        标签
        递交数
        141
        已通过
        71
        上传者