一、每日一题
直接暴力
class Solution {
public:
bool check(int i,int j)
{
if(i==1) return true;
while(i != j)
{
if(i>j) i-=j;
else j-=i;
}
if(i != 1) return false;
return true;
}
vector<string> simplifiedFractions(int n) {
vector<string> ans;
string temp;
if(n==1) return ans;
for(int j = 2;j <= n;j++)
{
for(int i = 1;i <= j - 1; i++)
{
if(check(i,j))
{
temp =to_string(i);
temp+='/';
temp+=to_string(j);
ans.push_back(temp);
}
}
}
return ans;
}
};
二、开学考试不讲武德,复习,明天好好继续练二分