- 博客(7)
- 收藏
- 关注
转载 递归于非递归的二分搜索法
#include #include #include using namespace std; // 二分查找法,在有序数组arr中,查找target // 如果找到target,返回相应的索引index // 如果没有找到target,返回-1 template int binarySearch(T arr[], int n, T target){ // 在arr[l...r
2017-02-28 18:11:57 224
转载 大位数加法和乘法模版
除法的模版还没仔细研究,在网上看到一个模版不错,收藏一下。 string sum(string s1,string s2) //大数加法 { if(s1.length()<s2.length()) { string temp=s1; s1=s2; s2=temp; } int i,j
2017-02-26 10:09:31 570
原创 Flip Game POJ - 1753
Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying
2017-02-25 19:40:35 214
原创 Curling 2.0 POJ - 3009
On Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is mark
2017-02-24 18:56:35 228
原创 Cleaning Shifts POJ - 2376
Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divided the day into T
2017-02-22 20:15:58 494
原创 Ball Aizu - 0033
这是个日文题目 题意: 有一个形似央视大楼(Orz)的筒,从A口可以放球,放进去的球可通过挡板DE使其掉进B裤管或C裤管里,现有带1-10标号的球按给定顺序从A口放入,问是否有一种控制挡板的策略可以使B裤管和C裤管中的球从下往上标号递增。 输入: 第一行输入数据组数N。接下来N行为N组具体数据,每组数据中有10个整数,代表球的放入顺序。 输出: 对于每组数据,若策略存在,输
2017-02-22 16:44:50 756
原创 简单的一个二叉树的模版
PS:这个模版的删除部分还不是特别理解,先记下来 struct node{ int val; node *lch, *rch; }; node *insert(node *p, int x){ if(p == NULL){ node *q = new node; q->val = x; q->lch = q->rch =
2017-02-20 20:00:45 307
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人