游客 Signup | Login
中文 | En

1119 - C语言3.4

求以下算术表达式的值:

(float)(a+b)/2+(int)x%(int)y

Input

只有一行,包含四个数a,b,x,y,用空格隔开。其中x和y是浮点数,a和b是整数。

Output

输出题目描述中表达式的值并保留6位小数。注意行尾输出换行。

Examples

Input

2 3 3.5 2.5

Output

3.500000

Solution 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;
}

Solution 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;
}
Time Limit 1 second
Memory Limit 32 MB
Discuss Stats
上一题 下一题