自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(149)
  • 收藏
  • 关注

转载 这个对不对呢?

#define maxNodes 15void createCSTree_Degree(CSTree &T, DataType e[], int degree[], int n){ //e层序序列,degree结点的度,n结点的个数 CSNode *pointer = new CSNode[maxNodes]; int i, j...

2019-05-03 12:45:00 235

转载 [蓝桥杯] 分苹果

题目描述小朋友排成一排,老师给他们分苹果。小朋友从左到右标号1..N。有M个老师,每次第i个老师会给第Li个到第Ri个,一共Ri-Li+1个小朋友每人发Ci个苹果。最后老师想知道每个小朋友有多少苹果。数据规模和约定100%的数据,N、M≤100 000,1≤Li≤Ri≤N,0≤Ci≤100。输入第一行两个整数N、M,表示小朋友个数和老师个数。接下来M行,每行三个整数Li、Ri、C...

2019-03-05 15:26:00 316

转载 [蓝桥杯]分数统计

题目描述给定一个百分制成绩T,将其划分为如下五个等级之一:90~100为A,80~89为B,70~79为C,60~69为D,0~59为E现有若干百分制成绩(成绩个数不超过1000个),请你统计五个等级段的人数,并找出人数最多的那个等级段,按照从大到小的顺序输出该段中所有人成绩(保证人数最多的等级只有一个)。输入第一行是成绩的个数 ...

2019-03-05 13:41:00 1029

转载 [蓝桥杯]分分钟的碎碎念

题目描述以前有个孩子,他分分钟都在碎碎念。不过,他的念头之间是有因果关系的。他会在本子里记录每一个念头,并用箭头画出这个念头的来源于之前的哪一个念头。翻开这个本子,你一定会被互相穿梭的箭头给搅晕,现在他希望你用程序计算出这些念头中最长的一条因果链。将念头从1到n编号,念头i来源于念头from[i],保证from[i]< i,from[i]=0表示...

2019-03-05 13:21:00 173

转载 八皇后

题目描述检查一个如下的6 x 6的跳棋棋盘,有六个棋子被放置在棋盘上,使得每行、每列有且只有一个,每条对角线(包括两条主对角线的所有平行线)上至多有一个棋子。上面的布局可以用序列2 4 6 1 3 5来描述,第i个数字表示在第i行的相应位置有一个棋子,如下:行号 1 2 3 4 5 6列号 2 4 6 1 3 5这只是跳棋放置的一个解。请编一个程序...

2019-03-05 12:55:00 89

转载 Catalan

推导过程中假定m[2]=1是最巧妙的设计#include<iostream>#include<algorithm>using namespace std;//catalan int main(void){ int n,m[100]; cin >> n; for(int i=2;i<=n...

2019-03-05 11:24:00 64

转载 汉诺塔问题

#include<iostream>#include<algorithm>using namespace std;void move(char c1,char c2){ cout << "move: " << c1 << c2 << endl; } void hanoi(c...

2019-03-05 10:48:00 81

转载 过河卒

题目描述棋盘上A点有一个过河卒,需要走到目标B点。卒行走的规则:可以向下、或者向右。同时在棋盘上C点有一个对方的马,该马所在的点和所有跳跃一步可达的点称为对方马的控制点。因此称之为“马拦过河卒”。棋盘用坐标表示,A点(0, 0)、B点(n, m)(n, m为不超过20的整数),同样马的位置坐标是需要给出的。现在要求你计算出卒从A点能够到达B点的路径的条数,假设马的位置是固定不动的...

2019-03-05 10:12:00 91

转载 位数问题

#include<iostream>#include<algorithm>using namespace std;int main(void){ int n; cin >> n; int a[100],b[100]; a[1]=1,b[1]=9; for(int i=2;i<=...

2019-03-05 09:04:00 73

转载 数塔问题

#include<iostream>#include<algorithm>#include<string>using namespace std;int myMax(int a,int b){ return a>b?a:b; }void print(int a[][100],int n){ for(int i...

2019-03-02 16:40:00 89

转载 逆序对

#include<iostream>#include<algorithm>#include<string>using namespace std;void print(int a[],int n){ for(int i=0;i<n;i++) cout << a[i] << '\t'; ...

2019-03-02 16:23:00 60

转载 归并排序

#include<iostream>#include<algorithm>#include<string>using namespace std;void print(int a[],int n){ for(int i=0;i<n;i++) cout << a[i] << '\t'; ...

2019-03-02 16:15:00 66

转载 快速排序

#include<iostream>#include<algorithm>#include<string>using namespace std;void print(int a[],int n){ for(int i=0;i<n;i++) cout << a[i] << '\t'; ...

2019-03-02 16:07:00 65

转载 回文数

#include<iostream>#include<algorithm>#include<string>using namespace std;const int len = 1010;void print(int a[]){ for(int i=1;i<=a[0];i++) { ...

2019-03-02 00:33:00 97

转载 高精度加减乘除,嗯嗯嗯嗯

#include<iostream>#include<algorithm>#include<cstring>#include<string>using namespace std;int myMax(int x,int y){ return x>y?x:y; }void print(int a[],...

2019-03-01 18:54:00 103

转载 [蓝桥杯][2014年第五届真题]套娃

时间限制: 1Sec 内存限制: 128MB 提交: 5 解决: 0题目描述 作为 drd 送的生日礼物,atm 最近得到了一个俄罗斯娃娃。他对这个俄罗斯娃娃的构造很感兴趣。 俄罗斯娃娃是一层一层套起来的。假设:一个大小为 x 的俄罗斯娃娃里面可能会放任意多个大小小于 x 的俄罗斯娃娃(而市场上的套娃一般大娃里只能放一个小娃)。 drd ...

2018-12-15 21:16:00 400

转载 蓝翔杯子校内赛练习代码

写的代码保存一下,留作纪念第一题#include<iostream>#include<cstdio>using namespace std;const int maxn = 1000010;int A[maxn];int main(void){ int n; cin>>n; whil...

2018-12-12 18:17:00 186

转载 [蓝桥杯][算法训练VIP]猴子分苹果

题目描述秋天到了,n只猴子采摘了一大堆苹果放到山洞里,约定第二天平分。这些猴子很崇拜猴王孙悟空,所以都想给他留一些苹果。第一只猴子悄悄来到山洞,把苹果平均分成n份,把剩下的m个苹果吃了,然后藏起来一份,最后把剩下的苹果重新合在一起。这些猴子依次悄悄来到山洞,都做同样的操作,恰好每次都剩下了m个苹果。第二天,这些猴子来到山洞,把剩下的苹果分成n分,巧了,还是剩下了m个。问,原来这些...

2018-12-07 00:10:00 188

转载 系统设计部分代码

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Linq;using System.Text;...

2018-11-30 17:10:00 255

转载 坐标离散化

#include<iostream>#include<algorithm>#include<vector>#include<cstring>#include<queue>using namespace std;int w,h,n;const int maxn = 500;int x1[maxn...

2018-11-28 20:16:00 140

转载 超大背包问题

#include<stdio.h>#include<algorithm>#include<iostream>typedef unsigned long long LL;using namespace std;const int maxn = 40;LL INF = (1<<32)-1;//const ...

2018-11-28 16:49:00 91

转载 移位运算

#include<iostream>#include<stdio.h>using namespace std;int main(void){ unsigned long long a = (1<<32)-1; long long b = (1<<31)-1; long long c = (1...

2018-11-28 16:44:00 119

转载 4 Values whose Sum is 0

Time Limit:15000MSMemory Limit:228000KTotal Submissions:30579Accepted:9351Case Time Limit:5000MSDescriptionThe SUM problem can be formulated as foll...

2018-11-28 12:52:00 95

转载 Physics Experiment POJ3684

Time Limit:1000MSMemory Limit:65536KTotal Submissions:3849Accepted:1361Special JudgeDescriptionSimon is doing a physics experiment withNidentical ...

2018-11-28 12:11:00 83

转载 FLIPTILE POJ NO.3279

唉#include<iostream>#include<algorithm>#include<cstring>#include<string>using namespace std;const int maxn = 16;int g[maxn][maxn];int flip[maxn][maxn];i...

2018-11-25 20:24:00 72

转载 [蓝桥杯][算法提高VIP]盾神与积木游戏

时间限制: 1Sec 内存限制: 128MB 提交: 11 解决: 4题目描述最近的m天盾神都去幼儿园陪小朋友们玩去了~每个小朋友都拿到了一些积木,他们各自需要不同数量的积木来拼一些他们想要的东西。但是有的小朋友拿得多,有的小朋友拿得少,有些小朋友需要拿到其他 小朋友的积木才能完成他的大作。如果某个小朋友完成了他的作品,那么他就会把自己的作品推倒,而无...

2018-11-20 11:08:00 302

转载 棋盘问题

题目描述在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。输入输入含有多组测试数据。每组数据的第一行是两个正整数n和k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。(n<=8,k<=n...

2018-10-12 13:17:00 105

转载 出栈次数的DFS计算

#include <iostream>#include <vector>#include <algorithm>#include <stack>#define N 24bool stored[N + 2];int ansCount;using namespace std;void print(st...

2018-10-12 11:38:00 324

转载 Bribe the Prisoners

题目描述In a kingdom there are prison cells (numbered 1 toP) built to form a straight line segment. Cells numberiandi+1are adjacent, and prisoners in adjacent cells are called "neighbours."...

2018-10-06 19:22:00 240

转载 Crazy Rows

代码如下:/* Crazy Rows */ #include<iostream>#include<cstdio>#include<algorithm>using namespace std;const int MAX_N=41;int M[MAX_N][MAX_N]; int a[MAX_N];...

2018-10-06 18:12:00 98

转载 一个简单的后最表达式计算

题目参考:信息学奥赛一本通398-1.2#include<iostream>#include<string>#include<cstring>using namespace std;int main(void) { string a; a="16 9 4 3 +*-@"; ...

2018-10-02 18:30:00 78

转载 杨辉三角形

import java.util.Scanner;public class Demo{ public static void main(String[] args) { Scanner cin = new Scanner(System.in); System.out.print("请输入一个整数:"); ...

2018-09-13 23:42:00 81

转载 string基本函数

例子:#include<string> #include<iostream>using namespace std;int main(void){ string str="abcdefghijklmn"; string str1=str.substr(0,5); string str2=str.substr(2...

2018-09-13 23:36:00 55

转载 substr()函数的使用

例子:#include<string> #include<iostream>using namespace std;int main(void){ string str="abcdefghijklmn"; string str1=str.substr(0,5); string str2=str.substr(2,5...

2018-09-13 23:00:00 128

转载 [蓝桥杯][算法提高VIP]传染病控制

时间限制: 1Sec 内存限制: 128MB 提交: 5 解决: 2题目描述近来,一种新的传染病肆虐全球。蓬莱国也发现 了零星感染者,为防止该病在蓬莱国大范围流行,该国政府决定不惜一切代价控制传染病的蔓延。不幸的是,由于人们尚未完全认识这种传染病,难以准确判别病毒 携带者,更没有研制出疫苗以保护易感人群。于是,蓬莱国的疾病控制中心决定采取切断传播途径的...

2018-07-31 17:43:00 324

转载 PAT甲级第二次真题练习

1005Spell It Right (20)(20分)提问Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:...

2018-07-30 23:41:00 155

转载 BFS()搜索加上hash

#include<algorithm>#include<cstdio>#include<iostream>#include<queue>#include<cstring>using namespace std;unsigned x;unsigned int goal;//最终状态表示的数...

2018-07-30 21:04:00 53

转载 PAT甲级第一次真题练习

1001 A+B Format (20)(20 分)提问Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digi...

2018-07-29 22:48:00 191

转载 一个小练习题

#include<iostream>#include<cmath>using namespace std;int n,a[10000000],b[10000000],mmin=10000000,vis[10000000];int c[1000000];void dfs(int p);int main(){ //freope...

2018-07-10 13:53:00 54

转载 八皇后

小学生兼职。#include<stdio.h>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int tot,c[1000],vis[3][1000],n;void search(int cur)//枚举第cu...

2018-07-10 12:59:00 37

空空如也

空空如也

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

TA关注的人

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