我是靠谱客的博主 懵懂含羞草,这篇文章主要介绍A / B Problem,现在分享给大家,希望可以做个参考。

本文最后更新于 329 天前,其中的信息可能已经有所发展或是发生改变。

题目描述

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默认精确度)即可。

复制代码
1
2
3
4
5
6
7
8
9
10
#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; }

最后

以上就是懵懂含羞草最近收集整理的关于A / B Problem的全部内容,更多相关A内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(58)

评论列表共有 0 条评论

立即
投稿
返回
顶部