【DidaOJ】[73]Wei Haokan's Little Red Flowers

Problem Description

Loading...

Problem Analysis

The statement is fairly clear and easy to follow, but there is one mental trap.

The problem asks for the maximum number of little red flowers you can get, so when doing the division you need to round down rather than the default rounding.

AC Code

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <iostream>

int main()
{
    int T;
    std::cin >> T;
    while (T--)
    {
        double a,b;
        std::cin >> a >> b;
        int ans = int(a/b);
        std::cout << ans << std::endl;
    }
    return 0;
}

Problem link: Wei Haokan’s Little Red Flowers - Problem Details - Problems - DidaOJ

Loading...