1 solutions

  • 0
    @ 2025-3-3 16:33:40

    C :

    #include <stdio.h>
    
     
    
    void main(){
    
        int n;
    
        scanf("%d",&n);
    
        printf("%.1f%%",(2*n-1+4) * 100.0 / (n * n));
    
    }
    

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    int n;
    cin>>n;
    int zonggong =n*n;
    int fense = 2*n+3;
    double r = (double)fense / zonggong * 100;
    cout<<fixed<<setprecision(1)<<r<<"%";
    return 0;
    }
    

    Python :

    n=int(input())
    s=(2*n+3)/(n*n)*100
    print('{:.1f}%'.format(s))
    
    • 1

    Information

    ID
    10654
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By