uva
---Panda
这个作者很懒,什么都没留下…
展开
-
DNA Consensus String UVA - 1368
https://vjudge.net/problem/19496这个想法比较有意思。 少数服从多数的感觉。 统计每个位置最多的。 然后空序列那个位置上填上最多的就可以了。 至于数量是不同的加起来就可以了。#include <iostream>#include <cstring>#include <iomanip>#include <cstdio>#include <string>#原创 2017-03-01 20:29:55 · 174 阅读 · 0 评论 -
Pipeline Scheduling UVA - 690
https://vjudge.net/problem/UVA-690有10个任务,5个管道,每个任务需要占用不同时间的管道,给出任务所占用管道的时间,求最短需要多少时间。dfs+剪枝,当当前开销加上剩余任务的最有情况仍大于ans。利用位运算模拟矩阵的情况,每次将无用的列往前移动。 之后判断需要往前移动多少能插入新的任务次序#include <bits/stdc++.h>using namespa原创 2017-04-12 17:33:48 · 331 阅读 · 0 评论 -
The Falling Leaves UVA - 699
Each year, fall in the North Central region is accompanied by the brilliant colors of the leaves on the trees, followed quickly by the falling leaves accumulating under the trees. If the same thing ha原创 2017-03-25 20:47:17 · 337 阅读 · 0 评论 -
Not so Mobile UVA - 839
https://vjudge.net/problem/UVA-839Before being an ubiquous communications gadget, a mobile was just a structure made of strings and wires suspending colourfull things. This kind of mobile is usually转载 2017-03-25 20:22:45 · 269 阅读 · 0 评论 -
Power Calculus UVA - 1374
https://vjudge.net/problem/UVA-1374题意就是最少多少次运算可以得到这个次方数 因为只有加法和减法两个运算。枚举的比较多。 所以要进行比较强的剪枝首先枚举深度计算 之后 如果最高位置最大方式运算也无法达到n的话就剪掉。#include <bits/stdc++.h>using namespace std;int n,maxs,tag[1000],z;vo原创 2017-04-10 20:08:42 · 277 阅读 · 0 评论 -
Division UVA - 725
https://vjudge.net/problem/UVA-725本着用看起来比较高大上的方法- - 搜索除数全排列 然后 乘比例 暴力查找#include <bits/stdc++.h>using namespace std;bool tag[12],d[10];int n;bool fun(int x){ while(x>0) { if(d[x%原创 2017-03-30 19:11:17 · 205 阅读 · 0 评论 -
Tree Recovery UVA - 536
https://vjudge.net/problem/UVA-536递归建树 , 利用中序和后序的规律,递归成树,按照后续遍历的方法输出 在先序的第一个 字母,可以找到中序的左右子树的分割, 然后这样一半一半的分割递归。和洛谷先序排列一个做法#include <bits/stdc++.h>using namespace std;string a,b;void dfs(int x,in原创 2017-03-30 11:25:13 · 231 阅读 · 0 评论 -
Undraw the Trees UVA - 10562
https://vjudge.net/problem/UVA-10562递归的方式就是对每个字母,查看下面是否有子树,这样一层一层的下去。 代码比较难。看书学代码。#include <bits/stdc++.h>using namespace std;const int maxn=210;int n;char buf[maxn][maxn];void dfs(int r,int c)//原创 2017-03-30 11:22:32 · 257 阅读 · 0 评论 -
Ordering Tasks UVA - 10305
https://vjudge.net/problem/UVA-10305思考了好几个小时,对递归的回溯利用有有了新的感觉, 之前全靠顿悟。 拓扑排序就是标记加深搜回溯。 后序遍历。 这样出来的序列又快 ,还是正确序列#include <bits/stdc++.h>using namespace std;#define maxn 105int tag[maxn][maxn];int d[原创 2017-03-29 16:51:55 · 285 阅读 · 0 评论 -
Rails UVA - 514
https://vjudge.net/problem/UVA-514判断出栈是否合法的方法- - 从出栈顺序找入栈顺序倒推一遍 简单模拟 == 若这个数先出栈 就入栈中一直入到可以找到这个数为止#include<bits/stdc++.h>using namespace std;stack<int > s;int n,j;int main(){ while(cin>>n原创 2017-03-12 20:01:22 · 302 阅读 · 0 评论 -
Xiangqi UVA - 1589
https://vjudge.net/problem/UVA-1589 待测:#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <map>#include <algorithm>#include <string>#include <set>#include <sstrea原创 2017-03-11 17:32:47 · 257 阅读 · 0 评论 -
Ananagrams UVA - 156
https://vjudge.net/problem/UVA-156#include<stdio.h>#include<stdlib.h>#include<string.h>#include <iostream>#include <map>#include <algorithm>using namespace std;map<string ,int > d;map<string ,s原创 2017-03-10 10:49:01 · 262 阅读 · 0 评论 -
Ancient Cipher UVA - 1339
https://vjudge.net/problem/UVA-1339若是两种字符数量一致 那么便是可以变换的#include<iostream>#include<string>#include <algorithm>#include <cstring>#include <cmath>#include <map>#include <cstdio>using namespace std;原创 2017-03-02 20:50:23 · 178 阅读 · 0 评论 -
Kickdown UVA - 1588
https://vjudge.net/problem/UVA-1588Kickdown UVA - 1588 一块一块区域的枚举匹配 保留下符合匹配的最小值 就是一点点的挪下去 #include<iostream>#include<string>#include <algorithm>#include <cstring>#include <cmath>#include <map>#原创 2017-03-02 20:00:52 · 229 阅读 · 0 评论 -
All in All UVA - 10340
https://vjudge.net/problem/UVA-10340对s 和 t 扫一遍 如果 s[i]==t[j] 则i++ ,j++ 代表这个字符得到 之后寻找下面的字符 否则就j++ 这样 如果 i走到了字符串末尾 那么 证明s可以从t得到#include <iostream>#include <cstring>#include <iomanip>#include <cs原创 2017-03-01 21:34:13 · 175 阅读 · 0 评论 -
Repeating Decimals UVA - 202
https://vjudge.net/problem/UVA-202一个循环节的姿势了。 用一个数塔的动态规划的想法解释 无论上面是从哪条路下来的 对于这个位置 向下的走法都是一样的对于这个题 无论上面的数字是什么 只要在做除法中 碰到的余数一样 那么 这个余数除以被除数的时候 以后的结果是和上面的一样的 所以 只看余数就可以了当一个余数出现两次的时候 意味着循环节出现了#i原创 2017-03-01 21:12:56 · 195 阅读 · 0 评论 -
1129: 第N个回文数 UVALive 2889
http://begin.lydsy.com/JudgeOnline/problem.php?id=1129和大佬不一样,用数数做的。 首先 任何一个回文数,都可以分解成两位组合1位的形式。然后从边缘递归。 注意最外层要从1开始。 然后 就开始数数。 比如5 位数等于2位数乘上3位数的个数。这里的三位数是包含010 000的 。 然后 这样数着进行递归。 用p记录没有限制的数量,d记录原创 2017-08-17 18:20:34 · 423 阅读 · 0 评论