题解 | #更相减损术#

更相减损术

https://ac.nowcoder.com/acm/problem/22164

#include <stdio.h>
#include <math.h>
int main()
{
    int m,n,i;
    int sum=0;
    scanf("%d %d",&m,&n);
while (n!=m)
{
    if (m>n)
         m=m-n;
    else 
       n=n-m;
}
    printf("%d",m);
    return 0;
}
全部评论

相关推荐

04-28 10:14
门头沟学院 Java
点赞 评论 收藏
分享
04-17 23:48
西北大学 Java
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务