题目描述
A/B Problem
Write a program which reads two integers a and b, and calculates the following values:
a ÷ b: d (in integer)
remainder of a ÷ b: r (in integer)
a ÷ b: f (in real number)
输入
Two integers a and b are given in a line.
输出
Print d, r and f separated by a space in a line. For f, the output should not contain an absolute error greater than 10^-5.
注:此题为特殊判断机制(special judge),精确到小数点后6位(long double默认精确度)即可。
#include<bits/stdc++.h>
using namespace std;
int main(){
long double a,b;
scanf(“%Lf %Lf”,&a,&b);
int c=(int)a;
int d=(int)b;
printf(“%d %d %Lf”,c/d,c%d,a/b);
return 0;
}