1 条题解

  • 0
    @ 2024-12-24 10:06:00

    C :

    #include<stdio.h>
    int main(){
    int a,b;
    double x,y;
    scanf("%d %d %lf %lf",&a,&b,&x,&y);
    printf("%.6lf\n",(float)(a+b)/2+(int)x%(int)y);
    return 0;
    }
    

    C++ :

    #include <stdio.h>
    int main() {
    	float x, y, ans;
    	int a, b;
    	scanf("%d %d %f %f", &a, &b, &x, &y);
    	ans = (float)(a + b) / 2 + (int)x % (int)y;
    	printf("%.6f\n", ans);
    	return 0;
    }
    

    Java :

    import java.util.*;
    public class Main {
    	public static void main(String args[]) {
    		Scanner cin = new Scanner(System.in);
    		double x,y;
    		int a,b;
    		a=cin.nextInt();
    		b=cin.nextInt();
    		x=cin.nextDouble();
    		y=cin.nextDouble();
    		double r = (float)(a+b)/2+(int)x%(int)y;
    		System.out.printf("%.6f",r);
    	}
    }
    
    • 1

    信息

    ID
    1736
    时间
    1000ms
    内存
    32MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者