![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法初学
Robin-_-
这个作者很懒,什么都没留下…
展开
-
## UVA - 400 Unix ls
UVA - 400 Unix ls题目大意:给定n和n个字符串,对n个字符串按字典序从小到大排序,按列优先顺序并以左对齐的方式输出,每个单词场宽为最长串长度+2,并且每行不超过60字符长度。解题思路: 直接用qsort排序,然后控制一下输出就可以了#include <cstdio>#include <cstring>#include <algorithm>int cmp(const void*原创 2016-07-13 14:11:46 · 178 阅读 · 0 评论 -
UVA - 10361 Automatic Poetry
UVA - 10361 Automatic Poetry题目大意:题目大意:给出两个序列,第一个 s1s3s5,第二个 S…。输出两个序列,第一个删除括号,即 s1s2s3s4s5,第二个将 s2 与 s4 交换位置后替换…,即 Ss4s3s2s5。解题思路:根据 < 和 > 将字符串分成 5个部分 交换 s2 s4 即可#include<iostream>#include<cstdio>#in原创 2016-07-08 19:16:26 · 263 阅读 · 0 评论 -
UVA - 1588 Kickdown
UVA - 1588 Kickdown题目大意:给出两个长度不一定相同且每列高度为 1 或 2 的长条,将它们放入一个高度为 3 的容器,求最短容器长度。解题思路:一个一个匹配 超过3的就不可以 然后左右移动上面的 取最小的#include<iostream>#include<cstring>#include<cstdio>int max(int x, int y) { if (x >原创 2016-07-08 19:16:07 · 330 阅读 · 0 评论 -
UVA - 1586 Molar mass?
UVA - 1586 Molar mass?题目大意:给一组化学式算出其质量解题思路:一个一个算就好了#include <cstdio>#include <cstring>#include <cstdlib>int main() { char b[100]; char a[100]; int N; scanf("%d", &N); getchar();原创 2016-07-08 19:15:46 · 228 阅读 · 0 评论 -
UVA - 401 Palindromes
UVA - 401 Palindromes题目大意:给定一个字符串判断是否回文 是什么样打回文解题思路:。。强行扫#include <iostream>#include <cstdio>using namespace std;int main () { string a,c; bool f; int t = 1; while (cin>>a ) {原创 2016-07-08 19:14:54 · 228 阅读 · 0 评论 -
UVA - 232 Crossword Answers
UVA - 232 Crossword Answers题目大意:给定一个网格 确定一些空格 和 字母 按从到右 从上到下的顺序 给每个词语编号 然后横向输出和纵向输出解题思路:顺序编号完 输出即可#include <stdio.h>#include <iomanip>using namespace std;int main(){ char a[105][105]; int b原创 2016-07-08 19:14:27 · 206 阅读 · 0 评论 -
UVA - 10340 All in All
UVA - 10340 All in All题目大意:给定2个字符串 判断后面一个字符串经过删减后是否能得到前面打字符串解题思路: 将前面打字符串的字符单个取出 并按顺序与后一个字符串 一一对比 #include <stdio.h>#include <string.h>int main(){ char a[100000],b[100000]; while (scanf("%s%原创 2016-07-08 19:14:00 · 228 阅读 · 0 评论 -
UVA - 1587 Box
UVA - 1587 Box题目大意:给6个方块判断能否组成长方体解题思路:排序后 暴力破解#include <stdio.h>#include <string.h>int main() { int a[6][2]; int q[3][2]; int t; bool b; int s; while (scanf("%d%d", &a[0][0],原创 2016-07-08 19:13:22 · 163 阅读 · 0 评论 -
UVA - 1368 DNA Consensus String
UVA - 1368 DNA Consensus String题目大意:给几串DNA 找出一组DNA要求 和这几组DNA 不一样的个数总数最少解题思路:将每一列中数目最多的DNA找出来组成一组DNA即可#include <stdio.h>#include <string.h>using namespace std;int main() { int t; int s;原创 2016-07-08 19:13:00 · 235 阅读 · 0 评论 -
UVA - 227 Puzzle
UVA - 227 Puzzle题目大意。给定一个5X5的格子,给定a~x的英文字母和一个空格,通过ablr移动位置解题思路:二维数组 交换 元素#include <iostream>#include <stdio.h>using namespace std;int main(){ char c; int n,m; bool t; int s = 1;原创 2016-07-08 19:12:37 · 185 阅读 · 0 评论 -
UVA - 455 Periodic Strings
UVA - 455 Periodic Strings题目大意。给一段字符串 然后求 该字符串最小打重复周期数解题思路:求字符串长度 分解其约数 然后用分别用约束个数打小字符串循环对比#include <iostream>using namespace std;int main(){ int n; cin>>n; string a; bool b; int原创 2016-07-08 19:12:05 · 168 阅读 · 0 评论 -
UVA - 1585 Score
UVA - 1585 Score题目大意。一个只含有‘O’和‘X’的一个字符串 每有一个’O’计数1 如何两个’O’在一起计数 1+2 =3 3个 计数 1+2+3=6 求该字符串计数总数解题思路:单独计算被’x’分开打’O’的计数 然后相加当总数#include <iostream>using namespace std;int main(){ int n; string a原创 2016-07-08 19:11:15 · 171 阅读 · 0 评论 -
UVA - 465 Overflow
UVA - 465 Overflow题目大意:检查两个数相加相乘会不会溢出 解题思路:atof直接把字符串读成浮点数,然后浮点数的范围比int的大的多,直接比较就行了。#include <cstring>#include <cstdio>#include <cstdlib>int main() { char a[10000]; char b[10000]; char原创 2016-07-09 15:17:50 · 210 阅读 · 0 评论