1 条题解

  • 1
    @ 2022-10-9 8:29:23

    C :

    int main()
    {int n,a,b,c;
    scanf("%d",&n);
    a=n/500;b=n%500/5;
        c=1000*a+5*b;
        printf("%d",c);
        
    }
    

    C++ :

    #include <bits/stdc++.h>
    #define int long long
    #define pb push_back
    #define fer(i,a,b) for(int i=a;i<=b;++i)
    #define der(i,a,b) for(int i=a;i>=b;--i)
    #define all(x) (x).begin(),(x).end()
    #define pll pair<int,int>
    #define et  cout<<'\n'
    #define xx first
    #define yy second
    using namespace std;
    template <typename _Tp>void input(_Tp &x){
        char ch(getchar());bool f(false);while(!isdigit(ch))f|=ch==45,ch=getchar();
        x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar();
        if(f)x=-x;
    }
    template <typename _Tp,typename... Args>void input(_Tp &t,Args &...args){input(t);input(args...);}
    vector<pll> v;
    const int N=1e6+10;
    signed main(){
        int n;
    	input(n);
    	int ans=0;
    	ans+=n/500*1000;
    	n%=500;
    	ans+=n/5*5;
    	cout<<ans;
    }
    

    Python :

    # coding=utf-8
    s=int(input())
    print((s%500)//5*5+(s//500*1000))
    
    • 1

    信息

    ID
    12832
    时间
    2000ms
    内存
    1024MiB
    难度
    4
    标签
    递交数
    203
    已通过
    99
    上传者