题解 | #将真分数分解为埃及分数#
将真分数分解为埃及分数
http://www.nowcoder.com/practice/e0480b2c6aa24bfba0935ffcca3ccb7b
一看到题目就想到了为什么不直接原分数(m/n)拆分成全是1/n的形式,那不是也是埃及数。
int main()
{
int numerator=0;
int molecule=0;
scanf("%d/%d",&molecule,&numerator);
for(int i=0;i<molecule;i++)
{
if(i<molecule-1)
printf("1/%d+",numerator);
else
printf("1/%d",numerator);
}
return 0;
}
想不到还真过了