1007. Calculate the remainder, 1007 calculate the remainder
1007. Calculate the remainder (Standard IO) Time Limit: 1000 MS space limit: 262144 KB Specific Limit
Calculate the remainder of two double-precision floating point numbers a and B. both a and B are positive numbers. Here, the remainder (r) is defined as: a = k * B + r, where k is an integer and 0 <= r <B. Enter the numbers a and B separated by two spaces in a row. The remainder of output a divided by B (two decimal places are reserved for the answer ). Sample Input
3 2
Sample output
1.00
Data range restrictions
Source/Author: CCF middle school student computer programming introductory exercise 2.6.4
Copyright©China Computer Society
The China Computer Society has the copyright to this topic (including questions and data ).
This Copyright/authorization form applies to all questions added by administrators
1 # include <iostream> 2 # include <cstdio> 3 # include <cmath> 4 using namespace std; 5 double a, B; 6 int main () 7 {8 cin> a> B; 9 printf ("%. 2lf ", a-(int (a/B) * B); 10 return 0; 11}