题解

广告屏幕

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

一个数的如果是合数,必定可以写成c = a X b,而a或者b其中必定有一个数小于等于c的开平方
比如16 = 1X16=2X8=4X4
所以只需要找出最小值中的最大值就行

#include <stdio.h>
#include <math.h>
int main()
{
    int i,n,max;
    max = 0;
    scanf("%d", &n);
    for (i = 1;i<=sqrt(n);i++)
    {
        if (n % i == 0)
            max = i;
    }
    printf("%d %d", max, n/max);
    return 0;
}
全部评论

相关推荐

Hyh_111:像这种hr就不用管了,基本没啥实力,换一个吧
点赞 评论 收藏
分享
评论
11
收藏
分享

创作者周榜

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