算法模板
我的世界有个L
南理工,软件工程
展开
-
二分查找(递归和非递归写法)
#include <iostream> #include <algorithm> using namespace std;const int maxn = 10005; int a[maxn];// 递归写法 int binary_search(int a[], int x, int l, int h) { if(l <= h) { int mid = (l + h) / 2原创 2016-06-26 15:28:06 · 451 阅读 · 0 评论 -
hdu 1002大数加法
第一次没有依赖Java的BigInteger,自己用C语言手写模拟,代码如下。注意,最后一行不要打印两个空格。欢迎各路大神提出意见。#include <stdio.h> #include <string.h>char a[1005], b[1005]; int ans[1005];int max(int m, int n) { if(m > n) return m;原创 2017-03-11 22:58:07 · 398 阅读 · 0 评论