参考自大佬的博客:https://blog.csdn.net/gg_gogoing/article/details/38753567
题目题面一个岛上有神与恶魔两个种族,神会说真话,恶魔会说假话。已知神与恶魔的个数,但不知道具体个人是属于哪个。
n,x,y
这个人问n次 ,x为神的个数,y为恶魔的个数。
每次的问题为 xi,yi,a 问xi ,yi是否为神? a为yes/no。注意xi,yi可能为同一个人
若最终可得出哪些是神则从小到大输出神的编号,并最终输出end
否则输出no
Input输入格式如下:
1234567n p1 p2 xl yl a1 x2 y2 a2 ... xi yi ai ... xn yn an
第一行有三个非负整数 n, p1, 和 p2. n 是 Akira 问的问题数. p1 和 p2 是在传说中记载的神族和恶魔族的人口数量。下面的每 n 行包括两个整数xi, yi和一个单词 ai。 xi 和 yi 是每个人的编号,号码范围从 1 到 p1 + p2。 ai 可能是 yes 或者 no。如果居民 xi 想让你认为 yi 是神族,他会回答 ...
参考自大佬的博客:https://www.cnblogs.com/stelayuri/p/12709923.html
题目题面A. Linova and Kingdomtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWriting light novels is the most important thing in Linova’s life. Last night, Linova dreamed about a fantastic kingdom. She began to write a light novel for the kingdom as soon as she woke up, and of course, she is the queen of it.
There are n cities and n−1 two-way roads connecting pairs of cities in the kingdo ...
题目最长不上升子序列
Input所有输入数据都是非负整数,且小于等于32767。每组数据最后一个数为-1。保证每组数据数量大小不超过1e5
Output每个测试的输出包括一个测试编号以及答案(具体看样例)。每组样例中间有一个空行
ExamplesInput38920715530029917015865-1233421-1-1
OutputTest #1: maximum possible interceptions: 6
Test #2: maximum possible interceptions: 2
代码1234567891011121314151617181920212223242526272829303132333435363738394041424344#include<stdio.h>int num[50000],len;/*num为dp数组,其中的数组地址的值表示长度,而其对应的值表示该长度下的序列末尾数值的最小值*/int solve(int k)/*二分,由于之前的序列都是采用的最优解,所以说长度越长末尾的数就越小,不然则反之利用这一规律用二分来 ...
题目The Triangle
题面73 88 1 02 7 4 44 5 2 6 5
(Figure 1)
Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top and ends somewhere on the base. Each step can go either diagonally down to the left or diagonally down to the right.
InputYour program is to read from standard input. The first line contains one integer N: the number of rows in the triangle. The following N lines describe the data of the tri ...
总线总线是连接各个部件的信息传输线,是 各个部件共享的传输介质
总线的分类片内总线芯片内部的总线
系统总线计算机各部件之间的信息传输线
数据总线双向 与机器字长、存储字长有关
地址总线单向(从cpu单向输出)与存储地址、 I/O地址有关
控制总线有出 有入中断请求、总线请求存储器读、存储器写总线允许、中断确认
通信总线用于 计算机系统之间 或 计算机系统与其他系统(如控制仪表、移动通信等)之间的通信传输方式串行通信总线并行通信总线
总线控制总线判优控制主设备(模块):对总线有 控制权从设备(模块):对总线有 控制权
链式查询连线简单,易于扩充,对电路故障最敏感
计数器定时查询优先级设置较灵活,对故障不敏感,连线及控制过程较复杂
独立请求方式响应速度快,优先级次序控制灵活,但连线多,总线控制复杂
分布式总线控制逻辑分布在连接总线的各部件或设备中.
总线通信控制同步通信(同步定时方式)由统一的时标控制数据传送
异步通信(同步定时方式)不互锁主设备发出请求信号,从设备发出应答信号,经过一定的延时,主设备不管有没有收到从设备的应答信号都会撤销请求信号,从设备也如此,不管 ...
数据模型它是对现实数据特征的抽象,数据模型是数据库系统的核心和基础。
概念模型按用户的观点对数据和信息进行建模
逻辑模型和物理模型逻辑模型层次模型(hierarchical model)有且只有一个节点没有双亲结点,这个节点称为根节点根以外的其他节点有且只有一个双亲节点
网状模型(network model)允许一个以上的节点没有双亲一个节点可以有多于一个双亲
关系模型(relational model)关系模型是指用二维表的形式表示实体和实体间联系的数据模型。(1)关系(Relation):一个关系对应着一个二维表,二维表就是关系名。(2)元组(Tuple):在二维表中的一行,称为一个元组。(3)属性(Attribute):在二维表中的列,称为属性。属性的个数称为关系的元或度。列的值称为属性值;(4)(值)域(Domain):属性值的取值范围为值域。(5)分量:每一行对应的列的属性值,即元组中的一个属性值。(6)关系模式:在二维表中的行定义,即对关系的描述称为关系模式。一般表示为(属性1,属性2,……,属性n),如老师的关系模型可以表示为教师(教师号,姓名,性别,年龄,职称,所在系) ...
sql基本语法增创建数据库1CREATE DATABASE database-name
表创建新表123create table 表名 (列名 数据类型 primary key(设置主键), 列名 数据类型 , 列名 数据类型 not null(不能设置空值))
创建索引1create [unique] index idxname on tabname(col….)
根据已有的表创建新表1create table tab_new as select col1,col2… from tab_old definition only
使用旧表创建新表1create table tab_new like tab_old
创建索引1create [unique] index idxname on tabname(col….)
将元素插入表1insert into table1(field1,field2) values(value1,value2)
创建视图1create view viewname ...
题目Common Subsequence
题面Cry对于泡妹子十分不熟练,在见到小姐姐后十分紧张,这时,他想起了czh对他的教诲,于是他决定尽可能找到自己与小姐姐的共同点。Cry靠他强大的人格魅力获取了小姐姐的基因片段,同时他也提供了自己的基因片段,现在我们假定,他们的公共点个数为两个片段的最长公共子序列中元素个数,cry有点方因为他完全不会做,他的幸福生活只能靠在座的各位了!
Input多组输入,每行有两个字符串,根据本czh的经验,如果对小姐姐问来问去是很失礼的一件事,因此每个基因片段长度最好不超过1000吧
Output每行一个答案,表示每组数据中他们的公共点个数
ExamplesInputabcfbc abfcabprogramming contestabcd mnp
Output420
思路这个题于poj1887有相似之处,寻找最长序列数因为这个题目有2个序列所以以一个为模板,逐个变化另一个字符串的开头字母,不断更新最后输出答案
代码123456789101112131415161718192021222324252627282930 ...
题目Max Sum
题面Given a sequence a[1],a[2],a[3]……a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.
InputThe first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines follow, each line starts with a number N(1<=N<=100000), then N integers followed(all the integers are between -1000 and 1000).
OutputFor each test ca ...
题目题面Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子
1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9
一个人可以从某个点滑向上下左右相邻四个点之一,当且仅当高度减小。在上面的例子中,一条可滑行的滑坡为24-17-16-1。当然25-24-23-…-3-2-1更长。事实上,这是最长的一条。
Input输入的第一行表示区域的行数R和列数C(1 <= R,C <= 100)。下面是R行,每行有C个整数,代表高度h,0<=h<=10000。
Output输出最长区域的长度。
ExamplesInput5 51 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9
O ...
题目题面You want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers, each being of a different kind, and at least as many vases ordered in a row. The vases are glued onto the shelf and are numbered consecutively 1 through V, where V is the number of vases, from left to right so that the vase 1 is the leftmost, and the vase V is the rightmost vase. The bunches are moveable and are uniquely identified by integers between 1 and F. These id-numbers have a sig ...
题目题面Maximum sumTime Limit: 1000MSMemory Limit: 65536KDescription
Given a set of n integers: A={a1, a2,…, an}, we define a function d(A) as below:Your task is to calculate d(A).
InputThe input consists of T(<=30) test cases. The number of test cases (T) is given in the first line of the input.Each test case contains two lines. The first line is an integer n(2<=n<=50000). The second line contains n integers: a1, a2, …, an. (|ai| <= 10000).There is an empty line ...









