uva

Perfect P-th Powers UVA - 10622

给出 n, 写成 n= x^p 的形式,求p最大值 #include <iostream> #include <vector> #include <cmath> #include <algorithm> using namespace std ; #define int long long int ......
Perfect Powers 10622 P-th UVA

Almost Prime Numbers UVA - 10539

#include <iostream> #include <cstring> #include <cmath> #include <algorithm> using namespace std ; const int M =1e6+33; #define int long long int b[M] ......
Numbers Almost 10539 Prime UVA

Sum of Consecutive Prime Numbers UVA - 121

#include <iostream> #include <cstring> #include <cmath> #include <algorithm> using namespace std ; const int M =1e4+33; int b[M],c[M],tot; int s[M] ; ......
Consecutive Numbers Prime Sum 121

Sum of Different Primes UVA - 1213

选择K个质数,使它们的和等于N。问有多少种方案? 例如,n=24, k=2时有3种方案:5+19=7+17=11+13=24 #include <iostream> #include <cstring> #include <cmath> #include <algorithm> using name ......
Different Primes 1213 Sum UVA

Magical GCD UVA - 1642

对序列A, 求 (j-i+1) * gcd( i, i+1, ... j ) 最大值 G(i) =gcd( G[i-1] ,a[i] ) 即前缀值不升 维护 1~j-1 可能的 i 值 (logn 个) O(n *log^2 #include <iostream> #include <map> #i ......
Magical 1642 GCD UVA

uva10214 Trees in a Wood.

类似 https://www.cnblogs.com/towboa/p/17303216.html , 不过给的是n ,m (n<=2000) 枚举 i (1<=i<=n) ,考虑 有多少 j (1<=j<=m) gcd__(i,j)==0 然后分段考虑 (gcd(x,y) = gcd(x,y-x) ......
10214 Trees Wood uva in

Lighting System Design uva11400

设计一个照明系统,一共有n(n<=1000)种灯泡可供选择,不同种类的灯泡必须用不同的电源,同一种灯泡则可以用一个,输入为一个n,以下n行,每行四个数值,代表电压V,电源费用K,每个灯泡费用C,所需灯泡数量L。n=0为结束标志。 为了省钱,你可以把一些灯泡换成电压更高的以节省电源的钱,但不能换成更低 ......
Lighting Design System 11400 uva

糖果 Candy uva1639

有两个盒子各有n (n<=2e5) 个糖,每天随机选一个(概率分别为p,1-p),然后吃一颗糖。直到有一天,没糖了!输入n,p,求此时另一个盒子里糖的个数的数学期望 假设最后某个盒子有 k 颗糖,然后计算概率即可 #include<iostream> #include<cstring> #inclu ......
糖果 Candy 1639 uva

Crossing Rivers uva12230

https://www.luogu.com.cn/problem/UVA12230 期望的线性性质 #include<iostream> #include<cstring> #include<algorithm> #include<set> using namespace std; int n,D; ......
Crossing Rivers 12230 uva

Pole Arrangement uva1638

有高度分别为1到n的n根杆子排成一行。如果你从左侧或右侧看这些杆,较小的杆被较高的杆遮挡。 给出杆子的数量n,从左能看到的杆子数量L,从右能看到的杆子数量R,求杆子有多少种排列方式 考虑高度1~n的柱子, 把高度1的插入 2~i 的某个排列中转移 f[i ][j] [k ]=f[i-1][j-1][ ......
Arrangement Pole 1638 uva

比赛名次 Race uva12034

两人赛马,最终名次有3种可能 求n人赛马时最终名次的可能性的个数 #include<iostream> #include<cstring> #include<algorithm> #include<set> using namespace std; #define mod 10056 int c[1 ......
名次 12034 Race uva

Critical Mass uva 580

#include<iostream> #include<cstring> #include<algorithm> #include<set> using namespace std; int f[44],n; signed main() { int i; f[3]=1,f[4]=3; for(i=5 ......
Critical Mass 580 uva

Headshot UVA - 1636

#include<iostream> #include<vector> #include<cstring> #include<algorithm> using namespace std; const int N=104; string s; void sov(){ int i; int len=s ......
Headshot 1636 UVA

GCD等于XOR GCD XOR uva12716

给定一个数字n,如样例所示格式输出满足1<=b<=a<=n且gcd(a,b)==a xor b的(a,b)二元组个数 #include<iostream> #include<vector> #include<cmath> #include<algorithm> using namespace std ......
GCD XOR 12716 uva

Choose and divide uva 10375

求C(i,j)/ C(u,v) 公式化简 筛出所有质数 除法的时候: 因数分解, 求对每个质数的个数的贡献 #include <iostream> #include <cstring> #include <cmath> #include <iomanip> #include <vector> usi ......
Choose divide 10375 and uva

uva 12086

树状数组 1. 求区间和 2. 单点赋值 还是单点改,通过维护一个a[ i ],来求改变值 #include <iostream> #include <cstring> #include <sstream> using namespace std; const int N=2e5+4; int n, ......
12086 uva

Cyborg Genes UVA - 10723

求一个最短序列,使得输入的两个串的均为他的子序列,同时输出方案数。 n+m-LCS 方案数转移时求 #include <iostream> #include <cstring> using namespace std; #define int long long int n,m; char a[10 ......
Cyborg 10723 Genes UVA

旅行 Tour uva1347

直角坐标系中,有 nn 个点。要求先从左往右走,再从右往左走,不重复的经过每一个点。 求出最短路径(距离为两点间直线距离)。 f [i ][j ] 表示点 1~max(i,j) 已走过,的路径长度 #include <iostream> #include <algorithm> #include < ......
Tour 1347 uva

UVA847 A Multiplication Game 题解

双方都想取胜,要让对方必败就得让对方,到一个必败的点(也就是自己的必胜点),对方就会必败,而必败的点可以从最后反推回来。 ......
题解 Multiplication Game UVA 847

例题3-2 WERTYU(WERTYU, UVa10082)

题目 把手放在键盘上时,稍不注意就会往右错一位。这样,输入Q会变成输入 W,输入J会变成输入K等。键盘如图3-2所示。 输入一个错位后敲出的字符串(所有字母均大写),输出打字员本来想打出 的句子。输入保证合法,即一定是错位之后的字符串。例如输入中不会出现 大写字母A。 样例输入 O S, GOMR ......
WERTYU 例题 10082 UVa

例题3-1 TeX中的引号(Tex Quotes, UVa 272)

题目 在TeX中,左双引号是“``”,右双引号是“''”。输入一篇包含双引号的文章, 你的任务是把它转换成TeX的格式。 样例输入 "To be or not to be," quoth the Bard, "that is the question". 样例输出 ``To be or not to ......
例题 引号 Quotes TeX 272
共171篇  :6/6页 首页上一页6下一页尾页