1 条题解

  • 0
    @ 2025-4-12 21:41:03

    C++ :

    #include <stdio.h>
    #include <string.h>
    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <queue>
    #include <set>
    #include <map>
    #include <string>
    #include <math.h>
    #include <stdlib.h>
    #include <time.h>
    using namespace std;
    
    int main()
    {
        //freopen("in.txt","r",stdin);
        //freopen("out.txt","w",stdout);
        float n, m;
        while(cin >> n >> m) {
            double sum = n / m;
            char str[1000];
            sprintf(str,"%.2f",sum);
            int len = strlen(str);
            if(str[len - 2] == '0' && str[len - 1] == '0')
                str[len - 3] = 0;
            else if(str[len - 1] == '0')
                str[len - 1] = 0;
            printf("%s\n",str);
        }
        return 0;
    }
    
    
    • 1

    信息

    ID
    1138
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者