C语言基础算法
coderqian
这个作者很懒,什么都没留下…
展开
-
分治法求最大最小值
文章目录题目描述样例输入输出代码实现题目描述使用分治算法,求一个数组中的最大数和最小数。Input多组数据输入,每组第一个数字为数组的长度n, 然后接下输入n个整数Output依次输出数组中的最大值与最小值样例输入输出样例输入5 1 5 2 4 36 1 2 3 4 5 6样例输出5 16 1代码实现#include<bits/stdc++.h>using namespace std;int maxn(int a[],int i,int j){ i原创 2021-07-30 09:37:39 · 1603 阅读 · 1 评论 -
(超好理解!)求大整数因数时间超限问题
关于解决求大整数因数时间超限问题题目描述输入输出代码实现题目描述从键盘输入一个数n(n<=100000000000),输出n的因子个数(包括本身)输入输出输入 :10输出:4代码实现#include <stdio.h>#include <stdlib.h>#include<math.h>int main(){ long long n; int s; while(~scanf("%lld",&n)) { s=0;原创 2021-07-24 14:11:58 · 525 阅读 · 2 评论