UVA

Hackers' Crackdown UVA11825

你需要将 n 个集合分成尽量多组,使得每一组里面所有集合的并集等于全集 3 2 1 2 2 0 2 2 0 1 4 1 1 1 0 1 3 1 2 0 f[S]= max(f[S], f[S-j] +1 ) 且 j是一个包含所有点的集合 #include <iostream> #include <a ......
Crackdown Hackers 11825 UVA 39

Robotruck UVA - 1169

有n个垃圾,第i个垃圾的坐标为(xi,yi),重量为wi。 有一个机器人,要按照编号从小到大的顺序捡起所有垃圾并扔进垃圾桶(垃圾桶在原点(0,0))。 机器人可以捡起几个垃圾以后一起扔掉,但任何时候其手中的垃圾总重量不能超过最大载重C。两点间的行走距离为曼哈顿距离(即横坐标之差的绝对值加上纵坐标之差 ......
Robotruck 1169 UVA

Add Again UVA - 11076

define S ,it is sum of all possible permutationsof a given set of digits. For example, if the digits are <1 2 3>, then six possible permutations are<1 ......
11076 Again Add UVA

The Super Powers UVA - 11752

求1~2^64 区间里, 有多少合法数X 合法数: X= a^b ,至少存在2个不同的a #include <iostream> #include <algorithm> #include <vector> using namespace std; const int N =65536+3; int ......
Powers Super 11752 The UVA

LCM Cardinality UVA - 10892

给出n, 求有多少对(a,b) (a<b), 满足 LCM(a,b) =n 暴力求所有因数 #include <iostream> #include <algorithm> #include <vector> using namespace std; const int N =1e4+20; #de ......
Cardinality 10892 LCM UVA

Again Prime? No Time. UVA - 10780

给定 m,n ,求最大的 k 使得 m^k∣n! 分解质因数 #include <iostream> #include <cstring> #include <sstream> using namespace std; const int N =1e4+20; const int inf =1e9 ......
Again 10780 Prime Time UVA

UVA10943 How do you add?

两个数 n,m,求 用 m 个 [0,n] 的整数相加使其和为 n 的方案数。 #include <iostream> #include <cstring> #include <sstream> using namespace std; const int N =102; const int mod ......
10943 UVA How add you

UVA11889

lcm(a,b)=c 给a,c ,求最小的b #include <iostream> #include <cstring> #include <sstream> using namespace std; #define int long long int a,b,c; int cnt[100]; i ......
11889 UVA

Uva--679 Dropping Balls(二叉树的编号)

记录 23:28 2023-4-16 https://onlinejudge.org/external/6/679.pdf reference:《算法竞赛入门经典第二版》例题6-6 二叉树,这里是完全二叉树,使用模拟的方式应该会TLE(虽然我用模拟的方式也TLE了,但不是这个原因,下面会提到原因) ......
Dropping Balls Uva 679

UVA1392 DNA Regions

https://www.luogu.com.cn/problem/UVA1392 给定两个长度为 n 的字符串 A 和 B,满足 A 和 B 都只由大写字母 A、C、G、T 组成。 求一个长度最长的闭区间 [L,R],满足对于 i∈[L,R] , 有不超过 p% 的 i 满足 Ai≠Bi ......
Regions 1392 UVA DNA

Unique Snowflakes uva11572

找最长的,没有相同元素的区间 双指针 #include <iostream> #include <set> using namespace std; const int N=1e6+2; int n,a[N]; void solve(){ int x=1,y=1,ans=0; set<int> st ......
Snowflakes Unique 11572 uva

UVA1451

二分平均值x,每个数减去x , 找区间 S[ r ]- S[l]>=0 ,r-l>=m #include <iostream> #include <vector> #include <algorithm> using namespace std; const int N=1e5+5; #define ......
1451 UVA

Sumsets UVA - 10125

一个集合中需要找到 a,b,c,d ,使得 a+b+c=d 枚举a,b ,计算a+b,存在map里 再枚举d,c ,计算d-c 是否 存在 d-c==a+b #include <iostream> #include <map> #include <algorithm> #include <vecto ......
Sumsets 10125 UVA

Maximum sum on a torus UVA - 10827

求 n×nn×n 的环状方阵上的最大子矩阵和。 构造 2*n *( 2*n) 的正方形 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N=300; int a[N] ......
Maximum 10827 torus sum UVA

UVA1382 Distant Galaxy

给出平面上的n个点,找一个矩形,使得边界上包含的点尽可能地多。 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N=200; struct T{ int x,y ; ......
Distant Galaxy 1382 UVA

UVA1330 City Game

利用网格图上空白的方格上建一个矩形的建筑。问地区中建筑物的最大面积 递推(dp) #include <iostream> #include <cstring> #include <sstream> using namespace std; const int N=1e3+2; char a[N][N ......
1330 City Game UVA

kuangbin专题一 简单搜索 起火迷宫(UVA-11624)

#Fire! ####Description Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a f ......
迷宫 kuangbin 专题 11624 UVA

UVA1650 数字串 Number String

对于任意一个只含数字1~n的有序数字串{a1,a2,……,an},比较数字串中所有相邻数字的大小,后者大于前者的用I表示,否则用D表示。例如,数字串{3,1,2,7,4,6,5},{2,1,3,7,4,6,5}和{3,1,2,7,5,6,4}就表示为'DIIDID'。"?"则表示两数的关系未知。例如 ......
数字 Number String 1650 UVA

Party at Hali-Bula UVA - 1220

多判断一个唯一性 only[ x] [0/1] #include <iostream> #include <cstring> #include <vector> #include <map> #include <algorithm> using namespace std; const int N= ......
Hali-Bula Party Hali Bula 1220

Another Crisis UVA - 12186

#include <iostream> #include <cstring> #include <vector> #include <algorithm> using namespace std; const int N=1e5+3; int f[N],n,K; vector<int> g[N]; ......
Another Crisis 12186 UVA

Alibaba UVA - 1632

在一条直线的同一个方向上有 nn 件珠宝,已知每件珠宝的位置,并且第 ii 件珠宝在 Ti时刻消失, 问将所有的珠宝收集起来最小耗时? 搜集不耗时,移动需要耗时 类似区间dp f[i ][ j ] [2] #pragma GCC optimize(2) #include <iostream> usi ......
Alibaba 1632 UVA

uva 11082 A Plug for UNIX

#include <iostream> #include <vector> #include <map> #include <queue> #include <cstring> using namespace std; const int N=1e4+2,M=5e5; int n1,n2,n3,le ......
11082 Plug UNIX uva for

Calling Circles UVA - 247

如果两个人相互打电话(直接或间接),则说他们在同一个电话圈里。例如, a打给b,b打给c, c打给d,d打给a,则这4个人在同一个圈里;如果e打给f但f不打给e,则不能推 出e和f在同一个电话圈里。 输入n(n≤25)个人的m次电话,找出所有电话圈。人名只包含字 母,不超过25个字符,且不重复 对于 ......
Calling Circles 247 UVA

一个研究课题 A Research Problem UVA10837

输入正整数m(m≤1e8),求最小的正整数n,使得φ(n)=m。n<=2e8。 #include<cstring> #include<algorithm> #include<iostream> #include <map> using namespace std; const int M=1e5+5 ......
研究课题 课题 Research Problem 10837

Semi-prime H-numbers UVA - 11105

所有形如4n+1(n为非负整数)的数叫H数。定义1是唯一的单位H数, H素数是指本身不是1,且不能写成两个不是1的H数的乘积。 H-半素数是指能写成两个H素数的乘积的H数(这两个数可以相同也可以不同)。 例如,25是H-半素数,但125不是。 输入一个H数h(h≤1000001),输出1~h之间有多 ......
Semi-prime H-numbers numbers 11105 prime

Computer Transformation UVA - 1647

初始串为一个1,每一步会将每个0改成10,每个1改成01,因此1会依次变成 01, 1001, 01101001,… 输入n(n≤1000),统计n步之后得到的串中, “00”这样的连续两个0出现了多少次 f =[0]*1003 g =[0]*1003 f[1]=0 g[1]=1 for i in ......
Transformation Computer 1647 UVA

Zeros and Ones UVA - 12063

给出n、k(n≤64,k≤100),有多少个n位(无前导0)二进制数的1和0一样多,且值为k的倍数? f[i][j][k] #include <iostream> #include <cstring> #include <cmath> #include <algorithm> using names ......
Zeros 12063 Ones UVA and

UVA1646 圈图的匹配 Edge Case

n个点连成一个圆,求没有公共点的边集的个数 不考虑第n条边 f[n] =f[n-1]+f[n-2] 现在考虑第n条边 ans=f[n]+f[n-2] f=[0]*10005 f[1]=1 f[2]=2 for i in range(3,10004): f[i] =f[i-1]+f[i-2] whil ......
1646 Edge Case UVA

Count UVA - 1645

f[n] = sum{ f[i] } ( (n-1)%i==0) f[1]=1 #include <iostream> #include <cstring> #include <cmath> #include <algorithm> using namespace std ; const int N ......
Count 1645 UVA

Divisors UVA - 294

求区间[L,R]的整数中哪一个的正约数最多。 一个数因数分解后, 它的约数Cnt = (a[j]+1) 的乘积 ,j是每个因数的个数 #include <iostream> #include <cstring> #include <cmath> #include <algorithm> using ......
Divisors 294 UVA