![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
紫书
小虎仔的csdn
欢迎来到算法的世界
展开
-
紫书开灯问题
开启好好学习模式#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>...原创 2019-03-25 10:48:25 · 109 阅读 · 0 评论 -
Bellman - ford 完美的最短路算法
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-30 20:04:47 · 138 阅读 · 0 评论 -
uva 232(字符串处理)
A crossword puzzle consists of a rectangular grid of black andwhite squares and two lists of definitions (or descriptions).One list of definitions is for “words” to be written left toright across w...原创 2019-03-26 21:35:06 · 198 阅读 · 0 评论 -
uva 136丑数
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-31 21:31:31 · 89 阅读 · 0 评论 -
UVa 1368
#include<stdio.h>#include<string.h>int main(void){ int t; scanf("%d",&t); while(t--){ int n,m; scanf("%d %d",&n,&m); char DNA[n][m+1]; for(int i=0;i<n;i++) s...原创 2019-03-27 18:53:52 · 132 阅读 · 0 评论 -
uva 202
The decimal expansion of the fraction 1/33 is 0.03, where the 03 is used to indicate that the cycle 03repeats indefinitely with no intervening digits. In fact, the decimal expansion of every rational ...原创 2019-03-27 20:19:40 · 272 阅读 · 0 评论 -
UVA10340 All in All (字符串匹配+水题)
You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss...原创 2019-03-27 20:46:31 · 247 阅读 · 0 评论 -
UVa1587
这道题主要是练习一下结构体的使用,包括初始化和运算符重载解题思路很简单,根据长方体六个面的结构特点,先把他们的长宽对进行排序那么0和1,2和3,4和5都应该是相等的然后判断他们的长度关系,0和2的宽应该是相等的,0和2的高分别是4的宽和高#include <iostream>#include <cstdio>#include <algorithm>...原创 2019-03-27 21:03:09 · 401 阅读 · 0 评论 -
UVA1594 Ducci Sequence 【模拟】
题目链接:https://vjudge.net/problem/UVA-1594题意:对于一个n元组(a1, a2, … , an),可以对于每个数求出它和下一个数的差的绝对值,得到一个新的 n 元组 (|a1-a2|, |a2-a3|, … , |an-a1|)。重复这个过程,得到的序列称之为 Ducci 序列。求Ducci数列如果在1000步以内循环了,就输出 LOOP,否则输出 ZERO...原创 2019-04-01 20:16:45 · 91 阅读 · 0 评论 -
Problem B: Throwing cards away I uva 10935
对于此题,我只能说很无奈,就是因为输入1的时候没有控制好,所以答案一直是错误的!Given is an ordered deck ofn cards numbered 1 tonwith card 1 at the top and cardn at the bottom.The following operation is performed as long as there are at le...原创 2019-04-01 21:02:34 · 111 阅读 · 0 评论 -
uva10763
题意:可以想象成数字的交换,然后最后判断是否有相换的数字是否有在换回来思路:如果匹配的話那麼兩邊的輸入排序後一定是一致的代碼:#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include ...原创 2019-04-01 21:23:59 · 109 阅读 · 0 评论 -
UVA-10391
题目:https://vjudge.net/problem/UVA-10391寻找组合单词直接利用set和string,将每个string拆成两部分,看能否在set中找到对应的部分#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#includ...原创 2019-04-02 13:17:46 · 140 阅读 · 0 评论 -
uva 156
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-30 17:14:01 · 113 阅读 · 0 评论 -
uva 10815
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-30 17:02:10 · 250 阅读 · 0 评论 -
蛇形填数
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-25 11:59:10 · 102 阅读 · 0 评论 -
猜数字游戏的提示(uva 340)
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-25 13:09:27 · 234 阅读 · 0 评论 -
生成元(uva 1583)
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-25 13:16:35 · 207 阅读 · 0 评论 -
环状序列(UVA 1584)
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-25 13:44:15 · 143 阅读 · 0 评论 -
得分(uva 1585)
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-25 15:58:57 · 112 阅读 · 0 评论 -
Molar mass UVA - 1586
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-25 16:35:32 · 147 阅读 · 0 评论 -
Digit Counting UVA - 1225
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-25 16:54:55 · 124 阅读 · 0 评论 -
uvaoj-455:周期串
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-25 19:06:55 · 175 阅读 · 0 评论 -
三、数列求值
给定数列1, 1, 1, 3, 5, 9, 17, …,从第4 项开始,每项都是前3 项的和。求第20190324 项的最后4 位数字。思路:改一下求斐波那契数列的代码就行了。(当然不用数组也是可以的)代码:#include <iostream>#include <cstdio>#include <algorithm>#include <c...原创 2019-03-25 19:30:51 · 2054 阅读 · 0 评论 -
UVa 227 Puzzle(谜题)
①输入55的字符,每个格子有一个字母,有一个格子是空格②找出输入字符空格的具体位置,保存下来③之后分别检测指令A,B,L,R,这里还需要注意边界的地方,④最后根据指令进行移动,最后从新输出每个格子的每个字符学习笔记:①这道题跟以前那道填数字的题目,有区别,因为题目中需要两个输入,格子形状输入用gets(a[i])表示第几行。输出的时候可以采用循环printf("%c %c %c %c %...原创 2019-03-25 20:42:53 · 180 阅读 · 0 评论 -
uva 10474
#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#include <queue>#include <stack>#include <set>#include...原创 2019-03-30 16:44:48 · 124 阅读 · 0 评论 -
stringstream,getline,你咋说
1.getline的用法输入一行2.stringstream重新定义输入输出流,定义一个字符串流,再次输入,题意:输入一行字符串,空格数不唯一,计算数字总和#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <cstrin...原创 2019-03-30 16:30:02 · 404 阅读 · 0 评论 -
1588 - Kickdown
题目要求简述:给定长度分别为n1,n2(n1,n2<=100)且每列的高度只为1或者2的长条。需要将他们放入一个高度为3的容器,问能够容纳它们的最短容器长度。分析:对于这样的题目显而易见有两种思路,第一,固定一个字符串,另一个从左到右进行移动。第二,固定一个字符串a,字符串b移动,再固定b,让a移动,取二者长度最小值。两种方法我都经过自己的实现,觉得还是第二种代码更简洁优雅,同时还具有...原创 2019-03-29 12:54:44 · 304 阅读 · 0 评论