分数的四则运算 分数约分分数加法分数减法分数乘法分数除法分数的输出 分数约分 #include <cstdio>
#include <algorithm>
using namespace std;
struct Fraction {//用结构体表示分子和分母int up, down;
};
int gcd(int a, int b) {//求出最大公约数if (b 0) {r…
Every day a Leetcode
题目来源:179. 最大数
解法1:贪心
对于数组 nums 中的任意两个数 a 和 b,我们将其转换为字符串后,如果 to_string(a) to_string(b) > to_string(b) to_string(a),说明 a 应该放在 b 的前…