随笔分类 - 二分
摘要:/* * binarysort.cpp * * Created on: 2013-10-8 * Author: wangzhu */#include#includeusing namespace std;#define NMAX 1000int arr[NMAX];int binarySearch(int left, int right, int key) { while (left = key) { right = mid - 1; } else { left = mid + 1; } } ...
阅读全文
摘要:/* * hdu2199.c * * Created on: 2011-10-9 * Author: bjfuwangzhu */#include<stdio.h>#include<math.h>#define eps 1.0e-10double f(double x) { return 8.0 * pow(x, 4.0) + 7.0 * pow(x, 3.0) + 2.0 * pow(x, 2.0) + 3 * x + 6;}void solve(double y) { double left, right, mid; left = 0.0, right = 1...
阅读全文
摘要:/* * hdu2141.c * * Created on: 2011-10-9 * Author: bjfuwangzhu */#include<stdio.h>#include<stdlib.h>#define nmax 5001#define nnum 250001#define LL long longLL numL[nmax], numN[nmax], numM[nmax], numLN[nnum];int cmp(const void *a, const void *b) { LL temp = *(LL *) a - *(LL *) b; if (temp
阅读全文
摘要:/* * hdu1969.c * * Created on: 2011-10-9 * Author: bjfuwangzhu */#include<stdio.h>#include<stdlib.h>#include<math.h>#define nmax 10010#define pi acos(-1.0)#define eps 1.0e-5double volume[nmax];int cmp(int n, double aver) { int i, temp; for (i = 0, temp = 0; i < n; i++) { temp +=
阅读全文
摘要:/* * hdu1511.c * * Created on: 2011-10-9 * Author: bjfuwangzhu */#include<stdio.h>#include<math.h>#define eps 1.0e-8#define nmax 10001double num[nmax];int cmp(int n, double aver) { int i, temp; for (i = 0, temp = 0; i < n; i++) { temp += (int) (num[i] / aver); } return temp;...
阅读全文
摘要:/* * hdu2899.c * * Created on: 2011-10-9 * Author: bjfuwangzhu */#include<stdio.h>#include<math.h>#define eps 1.0e-8double ff(double x, double y) { return 42.0 * pow(x, 6.0) + 48.0 * pow(x, 5.0) + 21.0 * pow(x, 2.0) + 10.0 * x - y;}double f(double x, double y) { return 6.0 * p...
阅读全文

浙公网安备 33010602011771号