自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(54)
  • 收藏
  • 关注

原创 2017青岛赛区亚洲区域赛网络赛 The Dominator of Strings

Problem DescriptionHere you have a set of strings. A dominator is a string of the set dominating all strings else. The string S is dominated by T if S is a substring of T.InputThe in

2017-09-18 17:04:06 637

原创 2017青岛赛区亚洲区域赛网络赛 1011题题解

Problem DescriptionA cubic number is the result of using a whole number in a multiplication three times. For example, 3×3×3=27 so 27 is a cubic number. The first few cubic numbers are 1,8,27,64 an

2017-09-17 18:23:47 977

原创 使用VS2010编写C#程序时总是提示正由另一进程使用,因此该进程无法访问此文件的解决办法

解决办法:1.因为这种情况并不是每次都出现,所以。假设项目名是test1。 先把VS关掉,然后把test1-->bin-->debug-->test1.exe强制删除。那么下次打开的时候,就可以了。因为debug下的test1.exe 每次都会重新生成。2. 选择 调试--->终止调试即可。3.尽量少用或者不用hide()方法,并且运行时

2017-09-16 10:32:39 11616

原创 Digital Roots 求一个数的数字根

The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two

2017-09-10 10:16:53 1022

原创 HDU - 1180 BFS 诡异的楼梯

Hogwarts正式开学以后,Harry发现在Hogwarts里,某些楼梯并不是静止不动的,相反,他们每隔一分钟就变动一次方向. 比如下面的例子里,一开始楼梯在竖直方向,一分钟以后它移动到了水平方向,再过一分钟它又回到了竖直方向.Harry发现对他来说很难找到能使得他最快到达目的地的路线,这时Ron(Harry最好的朋友)告诉Harry正好有一个魔法道具可以帮助他寻找这样的路线,而那个魔法道具

2017-09-07 10:41:58 449

原创 无平方因子数

题目:给出正整数n和m,区间[n,m]内的“无平方因子”的数有多少个?整数p无平方因子当且仅当不存在k > 1,使得p是k * k的倍数。1 #include #include #include #include #include using namespace std;const int maxn=100005; //求出根下m内的质数即可int p[maxn]

2017-09-02 09:35:02 1318

原创 C++ 两个高精度数相乘

#include #include #include #include #include using namespace std;const int N=1000;int main(){ string s1,s2; int a[N],b[N],sum[N]; int l1,l2; cin>>s1>>s2; l1=s1.length(); l2=s

2017-09-01 21:20:17 1063

转载 C++ 高精度加法 高精度减法 高精度乘法1

转自:http://blog.sina.com.cn/s/blog_4fdb102b010087ng.html前言:由于计算机运算是有模运算,数据范围的表示有一定限制,如整型int(C++中int 与long相同)表达范围是(-2^31~2^31-1),unsigned long(无符号整数)是(0~2^32-1),都约为几十亿.如果采用实数型,则能保存最大的double只能提供15~16位的

2017-09-01 20:44:21 2185

原创 深度优先搜索DFS和广度优先搜索BFS的总结

图的遍历顺序有两种:深度优先搜索(DFS)和广度优先搜索(BFS)深度优先算法思想DFS深度优先搜索遍历类似于树的先序遍历。假定给定图G的初态是所有顶点均未被访问过,在G中任选一个顶点i作为遍历的初始点,则深度优先搜索递归调用包含以下操作:(1)访问搜索到的未被访问的邻接点;(2)将此顶点的visited数组元素值置1;(3)搜索该顶点的未被访问的邻接点,若该邻

2017-08-31 16:56:15 621

原创 搜索 BFS HDU - 1072 

Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial

2017-08-31 16:02:59 317

原创 数据结构 树 哈夫曼树及编码 C语言版

//哈弗曼编码的算法#include #include #include #define N 50//叶子结点的最大值#define M 2*N-1 //所有结点的最大值typedef struct{ int weight; int parent; int LChild; int RChild;} HTNode,HuffmanTree[M+1];

2017-08-29 07:59:57 5825 3

原创 数据结构 图 Dijkstra算法

#include #include #include #include #include using namespace std;const int maxn = 1024;const int INF = 0x7fffffff;typedef pair P; //到这个点的最短路长度 和这个点int ans;struct edge //边的终点 和长度{ int

2017-08-29 07:59:36 508

原创 数据结构 图的遍历 C语言版

#include #include #define max_vertex_num 100 //最多顶点个数typedef char VertexData;typedef int AdjType ;typedef int OtherInfo ;typedef struct ArcNode{ int adj; //对于无权图 用1表示相邻 0表示不相邻 ;对于带权图,则为权值类型

2017-08-29 07:58:47 3590

原创 数据结构 图的建立 C语言版

#include #include #define max_vertex_num 100 //最多顶点个数typedef char VertexData;typedef int AdjType ;typedef int OtherInfo ;typedef struct ArcNode{ AdjType adj; //对于无权图 用1表示相邻 0表示不相邻 ;对于带权图,则为权值类

2017-08-29 07:57:52 7384 1

原创 数据结构 树 二叉树的建立及遍历 C语言版

//二叉树的建立以及先序、中序、后序遍历算法 以及统计二叉树的叶子结点数目算法#include #include typedef char DataType;typedef struct Node{ DataType data; struct Node *LChild; struct Node *RChild;} BiTNode,*BiTree; //定义二叉树void

2017-08-27 17:23:17 3093 5

原创 数据结构 树 层次遍历二叉树 C语言版

//层次遍历二叉树并输出结点的算法#include #include typedef struct NNode{ char data; struct NNode *LChild; struct NNode *RChild;} BiTNode,*BiTree; //定义二叉树结点和结点指针typedef BiTree QueueElementType;typedef str

2017-08-27 17:18:55 6938 3

原创 数据结构 链表 合并两个有序的单链表 C语言版

#include #include typedef struct Node{ int data; struct Node * next;} Node,* Linklist; //定义链表的结点,链表头void Initlist (Linklist *L) //初始化链表{ *L=(Linklist)malloc(sizeof(Node)); (*L

2017-08-27 17:07:29 3999

原创 数据结构 链表 循环单链表的建立 C语言版

#include #include typedef struct Node{ int data; struct Node * next;} Node,* Linklist; //定义链表的结点,链表头void Initlist (Linklist *CL) //初始化链表{ *CL=(Linklist)malloc(sizeof(Node)); (

2017-08-27 17:02:33 1038

原创 数据结构 链表 单链表的建立 C语言版

#include #include typedef struct Node{ int data; struct Node * next;} Node,* Linklist; //定义链表的结点,链表头void Initlist (Linklist *L) //初始化链表{ *L=(Linklist)malloc(sizeof(Node)); (*L

2017-08-27 17:00:05 1245

原创 数据结构 链队列的建立及其函数 C语言版

#include #include typedef int QueueElementType;typedef struct Node{ QueueElementType data; struct Node *next;} LinkQueueNode; //定义队列结点typedef struct{ LinkQueueNode *front; //队列头结点

2017-08-27 16:56:19 1141

原创 数据结构 顺序串的建立及其函数 C语言版

#include #include #define MAXLEN 100typedef struct{ char ch[MAXLEN]; int len;} SString;int SteInsert (SString *s,int pos,SString t) //在串s中下标为pos的字符之前插入串t;{ int i; if(poss->len)

2017-08-27 16:54:07 5544

原创 数据结构 栈 无括号算术表达式处理算法 C语言版

#include "seqstack.h"#include "stdio.h"#include char ch;int ExpEvaluation()/*读入一个简单算术表达式并计算其值。operatsign和operatdata分别为运算符栈和运算数栈OPS为运算符集合*/{    char x,y;    char op;    int a,b,v;

2017-08-27 16:52:19 2864

原创 数据结构 栈的建立及入栈出栈操作 C语言版

//链栈的建立及其出栈入栈操作#include #include typedef int StackElementType ;typedef struct SNode{    StackElementType data;    struct SNode * next;} LinkStackNode,* LinkStack;  //定义链表的结点,链表头v

2017-08-27 16:48:46 4146

原创 栈 括号匹配

#include #include #define Stack_size 100typedef char ElemType;typedef struct Node{    ElemType elem[Stack_size];    int top;} Seqstack;void Initstack (Seqstack *s){    s->top=-1;

2017-08-27 16:47:02 600 1

原创 【搜索】泡泡龙 DFS

题目描述这是一个简化版的网络游戏:在一个N×N方块构成的棋盘中,每个方块均涂上红、黄、蓝、绿(记为l、2、3、4)中的一种颜色,游戏者可以在最底行任意找一个方块,用鼠标双击这个方块,于是该方块及与之相邻(即在上、下、左、右四个方向上有公共边)的所有的同色方块均被消掉,而因下方失去支持的方块将会自由落下填补空位。样例中给出一个4×4的棋盘样例,当游戏者双击最底层左边第二个方块后,将会形成

2017-07-25 18:39:07 1145 1

原创 【分治】化装晚会

题目描述万圣节又到了!FJ打算带他的奶牛去参加化装晚会,但是,FJ只做了一套能容下两头总长不超过S (1≤S≤1000000)的奶牛恐怖服装。FJ养了N(2≤N≤20000)头按1--N顺序编号的奶牛,编号为i的奶牛的长度为L_i(1≤L_i≤1000000)。如果两头奶牛的总长度不超过S,那么她们就能穿下这套服装。FJ想知道,如果他想选择两头不同的奶牛来穿这套衣服,一共有多少种满

2017-07-25 18:34:19 2391

原创 宁波市第31届中小学程序设计比赛模拟试题 【动态规划】cirs

题目描述Czyzoiers 都想知道小 x 为什么对鸡蛋饼情有独钟。经过一番逼问,小 x 道出了实情:因为他喜欢圆。最近小 x 又发现了一个关于圆的有趣的问题:在圆上有2N 个不同的点,小 x 想用 N 条线段把这些点连接起来(每个点只能连一条线段),使所有的线段都不想交,他想知道这样的连接方案有多少种?输入有且仅有一个正整数 N(N≤3000)。输出要求的

2017-07-25 18:26:37 696

原创 宁波市第31届中小学程序设计比赛模拟试题 match 九宫格填字母

题目描述小 x 在解说 F7 决赛时的搭档是韩乔生,以至于小 x 没有任何能说上话的机会。无聊的他玩起了填字游戏。一个 3*3 的九宫格里,每个格子里都被填上了一个字母,从而我们得到了 6 个单词。现在,小 x 随手写了 6 个单词,他想让你帮他找到一种填字母的方案,使得这 6 个单词都出现在了九宫格里。输入共六行,每行一个长度为 3 的单词(全部大写)。输出

2017-07-25 18:23:18 1167

原创 宁波市第31届中小学程序设计比赛模拟试题 chicken

[提交][状态][讨论版]题目描述小 x 非常喜欢小鸡翅。他得知 NSC 超市为了吸引顾客,举行了如下的活动:一旦有顾客在其他超市找到更便宜的小鸡翅,NSC 超市将免费送给顾客 1000g 小鸡翅。小 x 为了尽可能的省钱,走遍了各大超市,统计了小鸡翅的价格。NSC 的工作人员通过不法手段盗取了这些资料。现在 NSC 的工作人员希望你能帮他们定一个尽可能低的价格(1000g 小

2017-07-25 18:20:01 1250

原创 宁波市第32届中小学生程序设计竞赛(初中组) 母鸡下蛋

问题 C: 母鸡下蛋鸡国中的母鸡最擅长下蛋了,MGMG 是鸡国中一只以下蛋产量高而闻名全鸡国的母鸡。 鸡国专供下蛋的 n 个鸡窝呈一字排列在鸡国的“下蛋中心”,从左到右依次编号为 1 到n。每个鸡窝都有一个最大可下蛋的量,其中第 i 个鸡窝的最大可下蛋量为 ci 。有时候由于MGMG 产量实在太大而无法在一个鸡窝中下完所有的蛋,不得不转移到隔壁的鸡窝继续下蛋,如果隔壁的鸡窝还是不能让它

2017-07-25 18:14:07 1705 2

原创 宁波市第32届中小学生程序设计竞赛(初中组) 公鸡打鸣

题目描述鸡国中有两只最喜欢打鸣的公鸡 G1 和 G2,它们每一次打鸣都有一个声音的响度值。一天清晨,G1 开始先开始打鸣,响度值为 x,G2 听到 G1 的打鸣后也开始打鸣,响度值为y。G1 和 G2 很想把它们打鸣声音的响度值调成一样。所以它们进行了 k 次协商,每一次协商后就各自增加或减少一定的响度值再打鸣一次(打鸣的响度值不能小于 0)。G1 和 G2 生性迟钝,它们不知道其实经

2017-07-25 18:10:01 1812

原创 Flip Game POJ - 1753

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 either it's bl

2017-05-31 11:19:48 453

原创 Thrall’s Dream BFS 实现图之间的访问性

We never paid any heed to the ancient prophecies, like fools we clung to the old hatreds, and fought as we had for generations. Until one day the sky rained fire, and a new enemy came upon us. We stan

2017-04-29 21:54:59 424

原创 A^X mod P 大幂分解求和 打表

It's easy for ACMer to calculate A^X mod P. Now given seven integers n, A, K, a, b, m, P, and a function f(x) which defined as following.f(x) = K, x = 1 f(x) = (a*f(x-1) + b)%m , x > 1

2017-04-29 21:25:28 937

原创 Dollar Dayz POJ - 3181 动态规划 完全背包

Farmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are selling variously for $1, $2, and $3. Farmer John has exactly

2017-04-25 10:55:00 448

原创 01背包 HDU - 2955 小偷抢银行

The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has decided to work in the lucrative

2017-04-23 11:03:06 548

原创 蒸包子凑数 完全背包 蓝桥杯

标题:包子凑数小明几乎每天早晨都会在一家包子铺吃早餐。他发现这家包子铺有N种蒸笼,其中第i种蒸笼恰好能放Ai个包子。每种蒸笼都有非常多笼,可以认为是无限笼。每当有顾客想买X个包子,卖包子的大叔就会迅速选出若干笼包子来,使得这若干笼中恰好一共有X个包子。比如一共有3种蒸笼,分别能放3、4和5个包子。当顾客想买11个包子时,大叔就会选2笼3个的再加1笼5个的(也可能选出1笼3个的再加2笼4个的

2017-04-23 10:03:13 4126 7

原创 完全背包 POJ - 2063 

John never knew he had a grand-uncle, until he received the notary's letter. He learned that his late grand-uncle had gathered a lot of money, somewhere in South-America, and that John was the only in

2017-04-23 09:55:46 501

原创 完全背包基础 HDU - 1114 

Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The idea behind is simple

2017-04-23 09:28:05 413

原创 01背包+完全背包 HDU - 5410 

Today is CRB's birthday. His mom decided to buy many presents for her lovely son.She went to the nearest shop with MMWon(currency unit). At the shop, there are NNkinds of presents. It

2017-04-22 21:53:46 328

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除