UVA
yonuyeung
武汉科技大学
展开
-
UVA 101 The 3n + 1 problem
题目链接:https://www.luogu.com.cn/problem/UVA100 i和j的大小关系比较坑 输出的时候,i和j的顺序需要和输入的时候一样 思路: 做法二:用map记录数字的周期,减少重复运算 做法三:时间最快,把10000个数字的周期先打印出来 目录 做法一:模拟 做法二:通过牺牲空间记忆数字来优化时间 做法三:打表 做法一:模拟 #include<iostream> #include<algorithm> using namespa原创 2022-01-07 22:35:00 · 442 阅读 · 0 评论 -
489 Hangman Judge (UVA)
目录 AC source code: Vocabulary: "turned over"is equal to elimination. AC source code: #include<iostream> #include<cstring> #include<cmath> #include<algorithm> using namespace std; char s[105]; char b[105]; int ma..原创 2021-11-25 20:55:19 · 155 阅读 · 0 评论 -
1339 Ancient Cipher(UVA)
No matter how encrypted it is, we can solve the problem as long as we find the essential characteristics. AC source code: #include<iostream> #include<cstring> #include<algorithm> using namespace std; char s1[1005],s2[1005]; int c...原创 2021-11-25 20:00:30 · 173 阅读 · 0 评论 -
227 Puzzle (UVA)
思路:按照题目要求移动就行了,就是个模拟题 注意: 1.处理好出界问题 2.有些一行只有四个字符,自己要给它补一个空格 AC码 #include <stdio.h> #include <string.h> //自定义函数 int move(int com); int swash(int i1, int j1, int i2, int j2); int prt(int k, int kase); //定义变量和数组 char puzzle[6]...原创 2021-11-14 08:54:30 · 218 阅读 · 0 评论 -
1597 BOX (UVA)
目录 思路: 代码实现: 学习到的东西:写代码时将数组放在main函数的外面 思路: 代码实现: 学习到的东西:写代码时将数组放在main函数的外面 为什么大数组要定义在main函数外 ...原创 2021-11-14 10:56:48 · 203 阅读 · 0 评论 -
1368 DNA Consensus String (UVA)
这道题要求字符串之间互相比较数据,数据比较多,不建议使用常规的算法,多想想有没有更简单的思路。原创 2021-11-13 11:52:22 · 697 阅读 · 0 评论 -
10340 All in All (UVA)
思路: 逐个比较就行了 第二个循环里面,令j=k,k=j+1,巧妙地避开了重复比较 注意: 数组开的大小尽量的大,因为题目没有明确的说明。 最开始开的10000,结果显示runtime error,我还以为是超时,其实不是。 数组开小了,循环里面会越界,导致死循环。 所以:显示运行时间错误的时候,不一定是数太大太多了,也有可能是位置小了。 关于数组越界的详细的解释:https://www.cnblogs.com/divebombchen/p/10449124.html ...原创 2021-11-11 12:59:28 · 65 阅读 · 0 评论 -
455 Periodic Strings (UVA)
思路: 基础: 1.知道一个字符串有多长 #include<stdio.h> #include<string.h> int main() { int n,i; scanf("%d",&n); getchar(); char str[85]; while(n--) { gets(str); } for(i=0;str[i]!='\0';i++); printf("长度为%d",i原创 2021-11-10 23:21:21 · 206 阅读 · 0 评论 -
1585 Score(UVA)
做法一:scanf一个一个地读取 #include<stdio.h> int main() { int n; scanf("%d",&n); getchar(); for(int i=0;i<n;i++) { int score=0,state=0; char a; while(scanf("%c",&a)&&a!='\n') { ...原创 2021-11-09 22:44:20 · 194 阅读 · 0 评论