摘要: 给出一个字符串,求该字符串的一个子串s,s包含A-Z中的全部字母,并且s是所有符合条件的子串中最短的,输出s的长度。如果给出的字符串中并不包括A-Z中的全部字母,则输出No Solution。 Input 第1行,1个字符串。字符串的长度 <= 100000。 Output 输出包含A-Z的最短子串 阅读全文
posted @ 2018-07-18 21:25 王陸 阅读(585) 评论(0) 推荐(0) 编辑
摘要: 一个正整数,如果它能被7整除,或者它的十进制表示法中某个位数上的数字为7,则称其为与7相关的数。求所有小于等于N的与7无关的正整数的平方和。 例如:N = 8,<= 8与7无关的数包括:1 2 3 4 5 6 8,平方和为:155。 Input 第1行:一个数T,表示后面用作输入测试的数的数量。(1 阅读全文
posted @ 2018-07-18 19:31 王陸 阅读(1169) 评论(0) 推荐(0) 编辑
摘要: 1.一只小蜜蜂 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数。 其中,蜂房的结构如下所示。 Input输入数据的第一行是一个整数N,表示测试实例的个数,然后是N 行数据,每行包含两个整数a和b(0<a<b<50)。 Output对于每个测试实 阅读全文
posted @ 2018-07-18 13:34 王陸 阅读(581) 评论(0) 推荐(0) 编辑
摘要: spfa的算法思想(动态逼近法): 设立一个先进先出的队列q用来保存待优化的结点,优化时每次取出队首结点u,并且用u点当前的最短路径估计值对离开u点所指向的结点v进行松弛操作,如果v点的最短路径估计值有所调整,且v点不在当前的队列中,就将v点放入队尾。这样不断从队列中取出结点来进行松弛操作,直至队列 阅读全文
posted @ 2018-07-17 16:11 王陸 阅读(645) 评论(0) 推荐(0) 编辑
摘要: Description “年”是一个生活在海洋深处的怪物。每年,它都出现在陆地上,吞噬牲畜甚至是人。为了让怪物离开,人们用红色,光线和爆炸的声音填满他们的村庄,所有这些都吓跑了怪物。 小汤米有 n 个灯笼,大班班有灯笼。汤米的灯具有亮度a1,a2,...,an,而Banban的亮度分别为亮度b1,b 阅读全文
posted @ 2018-07-16 16:20 王陸 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 一、概念: 在数论,对正整数n,欧拉函数是小于n的正整数中与n互质的数的数目(φ(1)=1)。 例如φ(8)=4,因为1,3,5,7均和8互质。 欧拉函数用希腊字母φ表示,φ(N)表示N的欧拉函数. 对φ(N)的值,我们可以通俗地理解为小于N且与N互质的数的个数(包含1). (初学者一定注意:此处的 阅读全文
posted @ 2018-07-16 12:44 王陸 阅读(2454) 评论(0) 推荐(1) 编辑
摘要: Two neighboring kingdoms decided to build a wall between them with some gates to enable the citizens to go from one kingdom to another. Each time a ci 阅读全文
posted @ 2018-07-14 20:07 王陸 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 1.建立结构体 2.空链表的创建 3.添加结点 4.删除结点 5.插入结点 应用 阅读全文
posted @ 2018-07-12 20:35 王陸 阅读(1947) 评论(0) 推荐(0) 编辑
摘要: 最近宿舍公用的网络一直不太稳定,正赶上毕业季,本来就打算自己买一台自用的路由器,于是我从一个毕业的师姐手里15RMB收了一台路由器,师姐还给了我一根5m的网线和两根全新15m的,感觉光网线就赚翻了。 下面是设置路由器上网的步骤 一、连接线路 将前端上网的宽带线连接到路由器的WAN口,上网电脑连接到路 阅读全文
posted @ 2018-07-08 12:51 王陸 阅读(957) 评论(0) 推荐(0) 编辑
摘要: 转载自:https://www.jb51.net/article/61506.htm 1、编译时计算运算符sizeof,可用类型或变量做参数,计算占用内存的大小。sizeof后若是类型必须加括弧,若是变量名可不加括弧。sizeof(x)可用来定义数组维数如: printf("%d\n", sizeo 阅读全文
posted @ 2018-07-06 13:07 王陸 阅读(644) 评论(0) 推荐(0) 编辑
摘要: Description Bessie has been hired to build a cheap internet network among Farmer John's N (2 <= N <= 1,000) barns that are conveniently numbered 1..N. 阅读全文
posted @ 2018-06-30 08:52 王陸 阅读(350) 评论(0) 推荐(0) 编辑
摘要: Description Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. 阅读全文
posted @ 2018-06-29 21:56 王陸 阅读(251) 评论(0) 推荐(0) 编辑
摘要: Description There are N beads which of the same shape and size, but with different weights. N is an odd number and the beads are labeled as 1, 2, ..., 阅读全文
posted @ 2018-06-29 21:39 王陸 阅读(310) 评论(0) 推荐(0) 编辑
摘要: Description N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than o 阅读全文
posted @ 2018-06-29 20:18 王陸 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 畅通工程 Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。 Input 测试输入包含若干 阅读全文
posted @ 2018-06-28 16:00 王陸 阅读(495) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; int gCard[52]; int num_card; struct sCard { int naPip[5]; //一共5张牌 int nNumber; //发了多少张牌 int nDollar;... 阅读全文
posted @ 2018-06-27 16:56 王陸 阅读(209) 评论(0) 推荐(0) 编辑
摘要: You are given nn strings. Each string consists of lowercase English letters. Rearrange (reorder) the given strings in such a way that for every string 阅读全文
posted @ 2018-06-26 16:25 王陸 阅读(1178) 评论(0) 推荐(0) 编辑
摘要: You are given n switches and m lamps. The i-th switch turns on some subset of the lamps. This information is given as the matrix aconsisting of n rows 阅读全文
posted @ 2018-06-26 16:06 王陸 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 转载自:c.biancheng.net/view/159.html 输入输出函数(printf 和 scanf)是C语言中非常重要的两个函数,也是学习C语言必学的两个函数。在C语言程序中,几乎没有一个程序不需要这两个函数,尤其是输出函数(printf),所以这两个函数必须要掌握。 如果在程序中要使用 阅读全文
posted @ 2018-06-26 15:13 王陸 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 说明此程序本来是21点扑克程序的一个被调函数,在这里我单独将它拿出来作为一个小程序。 阅读全文
posted @ 2018-06-26 11:13 王陸 阅读(1676) 评论(0) 推荐(0) 编辑
摘要: In the Bus of Characters there are nn rows of seat, each having 22 seats. The width of both seats in the ii-th row is wiwi centimeters. All integers w 阅读全文
posted @ 2018-06-26 08:59 王陸 阅读(323) 评论(0) 推荐(0) 编辑
摘要: i++ 与 ++i 的主要区别有两个:1、 i++ 返回原来的值,++i 返回加1后的值。2、 i++ 不能作为左值,而++i 可以。 毫无疑问大家都知道第一点(不清楚的看下下面的实现代码就了然了),我们重点说下第二点。首先解释下什么是左值(以下两段引用自中文维基百科『右值引用』词条)。 左值是对应 阅读全文
posted @ 2018-06-25 14:44 王陸 阅读(2426) 评论(0) 推荐(0) 编辑
摘要: Description 你的朋友Mishka和你参加一个微积分讲座。讲座持续n分钟。讲师在第i分钟讲述ai个定理。 米什卡真的对微积分很感兴趣,尽管在演讲的所有时间都很难保持清醒。给你一个米什卡行为的数组t。如果Mishka在演讲的第一分钟睡着了,那么ti将等于0,否则它将等于1.当米什卡醒来时,他 阅读全文
posted @ 2018-06-23 14:01 王陸 阅读(257) 评论(0) 推荐(0) 编辑
摘要: A has a string consisting of some number of lowercase English letters 'a'. He gives it to his friend B who appends some number of letters 'b' to the e 阅读全文
posted @ 2018-06-22 20:45 王陸 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 1、骑车与走路:我们的校园很大很大很大大大大大……,骑个自行车去办事会很快,比如取个快递了,到其他宿舍楼找个同(nv)学(you)了。但实际上,并非去办任何事情都是骑车快,因为骑车总要找车、开锁、停车、锁车等,这要耽误一些时间。假设找到自行车、开锁并骑上自行车的时间为27秒;停车、锁车的时间为23秒 阅读全文
posted @ 2018-06-22 11:58 王陸 阅读(1190) 评论(0) 推荐(2) 编辑
摘要: Description Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without 阅读全文
posted @ 2018-06-21 14:40 王陸 阅读(418) 评论(0) 推荐(0) 编辑
摘要: Description Given a positive integer N, you should output the most right digit of N^N. Description Given a positive integer N, you should output the m 阅读全文
posted @ 2018-06-21 13:40 王陸 阅读(665) 评论(0) 推荐(0) 编辑
摘要: Description Bacon's cipher or the Baconian cipher is a method of steganography (a method of hiding a secret message as opposed to a true cipher) devis 阅读全文
posted @ 2018-06-21 13:12 王陸 阅读(1171) 评论(0) 推荐(0) 编辑
摘要: Description 根据给定的字符串生成二叉树并前序、中序、后序此二叉树。 根据给定的字符串生成二叉树并前序、中序、后序此二叉树。 根据给定的字符串生成二叉树并前序、中序、后序此二叉树。 Input 给定一字符串,其中#表示空。 例:上图输入为 HDB#A##C##G#FE### Input 给 阅读全文
posted @ 2018-06-20 15:17 王陸 阅读(391) 评论(0) 推荐(0) 编辑
摘要: 一.文件基础和基本操作。 1.什么是文件? 为了长期保存数据以便重复使用、修改和共享,必须将数据以文件的形式存储到外部存储介质(如磁盘、U盘、光盘等)或云盘中。 文件:存储在外部介质上的数据或信息的集合 。 程序中的源程序 数据中保存着数据 图像中的像素数据 … 有序的数据序列。 2.文件中的编码 阅读全文
posted @ 2018-06-18 14:23 王陸 阅读(453) 评论(0) 推荐(1) 编辑