1 条题解

  • 0
    @ 2025-3-9 14:03:08
    /*#include <bits/stdc++.h>
    using namespace std;
    
    int main() 
    {
        //r = a - k * b
        double a,b;
        double r;
        cin >> a >> b; 
        r = (int)(a*100000) % (int)(b*100000);
        cout << r / 100000;
        return 0;
    }
    
    #include <iostream>
    #include <cmath>  // 包含对fmod函数的声明
    
    using namespace std;
    
    int main() {
        double a, b;
        // 输入两个双精度浮点数a和b
        cin >> a >> b;
        
        // 计算余数
        double remainder = fmod(a, b);
        
        // 输出余数
        cout.precision(4);  // 设置输出精度为4位小数
        cout << fixed << remainder << endl;
    
        return 0;
    }
    
    */
    
    #include <bits/stdc++.h>
    using namespace std;
    
    int main() 
    {
        //r = a - k * b
        double a,b;
        double r;
        cin >> a >> b; 
        r = fmod(a,b); //fmod函数取余数
        cout << r;
        return 0;
    }
    
    

    信息

    ID
    41
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    递交数
    22
    已通过
    8
    上传者