2 solutions

  • 0
    @ 2024-4-15 11:04:40
    #include<bits/stdc++.h> 
    using namespace std; 
    double n,s,q=2,sum=0; 
    int main(){ 
    cin>>s; 
    while(sum<s){ 
    sum=sum+q; 
    q=q*0.98; 
    n++; 
    } 
    cout<<n; }
    
    • 0
      @ 2023-12-4 15:56:02

      #include<bits/stdc++.h> using namespace std; double n,s,q=2,sum=0; int main(){ cin>>s; while(sum<s){ sum=sum+q; q=q*0.98; n++; } cout<<n; }

      • 1

      Information

      ID
      417
      Time
      1000ms
      Memory
      125MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      184
      Accepted
      43
      Uploaded By