1 条题解

  • 0
    @ 2023-6-11 12:20:39

    C :

    #include<stdio.h>
    int main()
    {
    	int a,b,c;
    	scanf("%d",&a);
    	printf("%d\n",a);
    	printf("%d\n",a+8);
    	printf("%d\n",a+6);
    	printf("%.1f",(3*a+14)*1.0/3);
    	return 0;
    }
    

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	cout<<n<<endl;
    	cout<<n+8<<endl;
    	cout<<n+6<<endl;
    	cout<<fixed<<setprecision(1)<<(n+n+8+n+6)/3.0<<endl;
        return 0;
    }
    
    

    Java :

    import java.util.Scanner;
    
    public class Main {
    	public static void main(String[] args) {
    		Scanner sc = new Scanner(System.in);
    		int n = sc.nextInt();
    		int y = n + 8;
    		int b = y - 2;
    		double p =(double) (n + y + b) /3;
    		System.out.println(n);
    		System.out.println(y);
    		System.out.println(b);
    		System.out.println(String.format("%.1f", p));
    	}
    }
    

    Python :

    a=int(input())
    b=a+8
    c=b-2
    print(a)
    print(b)
    print(c)
    print("%.1lf"%((a+b+c)/3))
    
    
    • 1

    信息

    ID
    2524
    时间
    1000ms
    内存
    64MiB
    难度
    10
    标签
    递交数
    8
    已通过
    1
    上传者