class Solution {
public:
vector<string> simplifiedFractions(int n) {
vector<string> ans;
for(int y=2;y<=n;y++){
for(int x=1;x<y;x++){
if(__gcd(x,y)==1){
ans.push_back(to_string(x)+'/'+to_string(y));
}
}
}
return ans;
}
};
The to_string() series of functions convert numeric values to string form
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326075625&siteId=291194637
Recommended
Ranking