自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 HDU4039 The Social Network(bfs)

The social network system (SNS) helps people to keep connecting with their friends. Every user in SNS has a friends list. The user can read news posted by the users in his friends list. Friend relation

2017-12-16 11:59:48 682

原创 全排列问题(c语言程序实现)

全排列问题:从n个不同元素中任取m(m≤n)个元素,按照一定的顺序排列起来,叫做从n个不同元素中取出m个元素的一个排列。当m=n时所有的排列情况叫全排列。如:1,2,3三个元素的全排列为:1,2,3;1,3,2;2,1,3;2,3,1;3,1,2;3,2,1#include<cstdio>#include<iostream>using namespace std;#define N 10000v

2017-12-13 10:54:04 8538 2

原创 使用公式Ack(m,n)=Ack(m-1,Ack(m,n-1)),依次递归计算,递归结束条件n=0时,Ack(m,n)=Ack(m-1,1);m=0时,Ack(m,n)=n+1

#include<cstdio>#include<iostream>using namespace std;int di(int m, int n){ if(n == 0) return di(m-1, 1); else if(m == 0) return n+1; else return di(m-1, di(m, n-

2017-12-13 10:52:35 4005

原创 古典问题:兔子出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问两年内每个月的兔子总数为多少?(斐波那切数列)

分析第一个月—————–1第二个月—————–1第三个月—————–2第四个月—————–3第五个月—————–5第六个月—————–8第七个月—————–13… …从中发现,从第三个月开始,前两个月兔子数之后为第三个兔子总数。 符合斐波那切数列 F(n) = F(n-1) + F(n-2)#include<cstdio>#include<io

2017-12-12 10:51:43 3725

原创 链表课后练习题(基础)

//13人围成一圈,报到3退出,找到留在圈子中的人原来的序号/*#include<cstdio>#include<iostream>#include<cstdlib>using namespace std;#define len sizeof(struct student)struct student{ int num; struct student *next;};s

2017-12-10 20:35:05 2662

原创 新标准大学英语综合教程2(第二版)unit1答案截图

新标准大学英语综合教程2(第二版)unit1答案

2017-12-10 10:45:47 136832 8

原创 打印学生成绩数组(结构体)

1#include<cstdio>#define N 5struct student{ int num; char name[50]; int score[4];}stu[N];void print(struct student stu[N]){ int i, j; printf("编号 姓名 成绩1 成绩2 成绩3\n");

2017-12-05 11:34:43 2363

原创 计算该日是该年的第几天(结构体)

1#include<cstdio>struct days{ int year; int month; int day;}d;int main(){ int x = 0; printf("请输入年月日:"); scanf("%d%d%d", &d.year, &d.month, &d.day); int p[13] = {0, 31,

2017-12-05 11:30:16 955

转载 STL中的set容器的一点总结

STL中的set容器的一点总结感谢文章的作者。文章转自:http://www.cnblogs.com/BeyondAnyTime/archive/2012/08/13/2636375.html1.关于setC++ STL 之所以得到广泛的赞誉,也被很多人使用,不只是提供了像vector, string, list等方便的容器,更重要的是STL封装了许多复杂的数据结构算法和大量常用数据结构操作。vec

2017-12-03 21:00:20 154

原创 POJ 1456 supermarket(贪心加并查集)

A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment the sa

2017-12-03 15:51:50 339

转载 判断一个数是否为质数/素数——从普通判断算法到高效判断算法思路

定义:约数只有1和本身的整数称为质数,或称素数。 计算机或者相关专业,基本上大一新生开始学编程都会接触的一个问题就是判断质数,下面分享几个判断方法,从普通到高效。1)直观判断法最直观的方法,根据定义,因为质数除了1和本身之外没有其他约数,所以判断n是否为质数,根据定义直接判断从2到n-1是否存在n的约数即可。C++代码如下: bool isPrime_1( int num ) {

2017-12-03 13:33:51 624

原创 HDU1213 How Many Tables (并查集)

Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, an

2017-12-02 21:38:04 141

原创 POJ2524 Ubiquitous Religions (并查集)

There are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university belie

2017-12-02 21:14:24 145

原创 POJ1611 The Suspects(并查集)

The SuspectsDescription Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, t

2017-12-02 17:59:32 180

原创 HDU1116 Play on words(欧拉回路加并查集)

Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very impor

2017-12-02 12:14:22 245

原创 HDU 1324Pseudo-Random Numbers

Computers normally cannot generate really random numbers, but frequently are used to generate sequences of pseudo-random numbers. These are generated by some algorithm, but appear for all practical pur

2017-12-02 00:18:14 267

原创 HDU 1232畅通工程

某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input 测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应M条道路,每行给出一对

2017-12-01 20:40:22 144

空空如也

空空如也

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

TA关注的人

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