1 solutions

  • 0
    @ 2025-11-5 19:45:04

    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

    Information

    ID
    19626
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By