1 条题解

  • 0
    @ 2024-12-18 14:07:27

    C :

    #include <stdio.h>
     int main()
     {
     	double a,b,c;
     	scanf("%lf",&a);
     	scanf("%lf",&b);
     	scanf("%lf",&c);
     	printf("%.1lf",(a*0.2+b*0.3+c*0.5));
     	return 0;
    
     }
    

    C++ :

    #include <bits/stdc++.h>
    #define int long long
    using namespace std;
    typedef long long LL;
    typedef pair<int,int> PII;
    const int MAX32=2147483647;
    void solve()
    {
        double a,b,c;
        cin>>a>>b>>c;
        double ans = (a*2+b*3+c*5)/10;
        printf("%.1lf",ans);
    }
    signed main()
    {
        // ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        int t;
        t=1;
        // cin>>t;
        while (t--)
        {
            solve();
        }
    }
    

    Java :

    import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            double low = 0;
            double up = 10.0;
            Scanner scanner = new Scanner(System.in);
            double A = scanner.nextDouble();
            double B = scanner.nextDouble();
            double C = scanner.nextDouble();
            if (A >=low && A<=up && B>=low && B<=up && C>=low && C<=up) {
            double number = A * 0.2 + B *0.3 +C * 0.5;
                System.out.println(String.format("%.1f",number));
            }
        }
    }
    
    • 1

    信息

    ID
    629
    时间
    1000ms
    内存
    128MiB
    难度
    5
    标签
    提交数
    153
    已通过
    57
    上传者