自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(41)
  • 资源 (3)
  • 收藏
  • 关注

原创 UVA - 10229 - Modular Fibonacci (矩阵快速幂 + fibonacci)

题目传送:UVA - 10229思路:就是简单的矩阵快速幂求fibonacci数列,然后注意可能中间结果会爆int,因为2^19有50多万AC代码:#include #include #include #include #include #include #include #include #include #include #include

2015-04-30 19:20:36 1109

原创 UVA - 10183 - How Many Fibs? (斐波那契 + 高精度)

题目传送:UVA - 10183思路:高精度就可以了,因为10^100以内的斐波那契数不多,根据公式来看,估计就500多,开个1000的数组足够啦,实现的话是用的java,注意这里的斐波那契是从1开始的,我一开始是从0开始的,wa了一下AC代码:import java.util.Scanner;import java.math.BigInteger;public

2015-04-30 15:08:32 999

原创 UVA - 10375 - Choose and divide (组合数)

题目传送:UVA - 10375思路:用double存答案,不过要注意是边乘边除,这样不会爆double,还有记得乘的时候要把int转换成doubleAC代码:#include #include #include #include #include #include #include #include #include #include #inclu

2015-04-30 13:49:33 688

原创 UVA - 10308 - Roads in the North (DFS)

题目传送:UVA - 10308思路:就是树的遍历,DFS即可,注意输入AC代码:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #defi

2015-04-30 00:58:50 677 1

原创 福州大学第十届程序设计竞赛 -- 部分题解

题目传送:福州大学第十届程序设计竞赛Problem A 神庙逃亡水题AC代码:#include#include#includeusing namespace std;int s, h, vx, vy;int main() { int w; cin >> w; while(w--){ cin >> s >> h >> v

2015-04-29 23:32:27 1143

原创 UVA - 10023 - Square root (模拟手算开方)

题目传送:UVA - 10023思路:模拟手算开方,不想用c/c++,感觉太麻烦了,就直接用的java里的BigInteger类来写的,写了好久......Java还是得看看书呀,手算开方参考的这里AC代码:import java.util.Scanner;import java.math.BigInteger;public class Main

2015-04-29 16:35:26 954

原创 UVA - 10717 - Mint (GCD + LCM)

题目传送:UVA - 10717思路:思路很明确,就是找出所有的四种硬币的组合,然后求出他们的最小公倍数,再去找出该最小公倍数的倍数中与desired length最接近的,昨晚不知道啥错误,一直WA,今天重写一下就过了AC代码:#include #include #include #include #include #include #include #

2015-04-29 10:03:57 704

原创 UVA - 571 - Jugs (数论 - 经典倒水问题)

题目传送:UVA - 571思路:A为空时就加满,不空就倒给B,B满了后就全倒掉,直到B的容量为n(参考)AC代码:#include #include #include #include #include #include #include #include #include #include #include #include #define

2015-04-28 22:22:30 940

原创 UVA - 11029 - Leading and Trailing (快速幂+公式变形)

题目传送: UVA - 11029思路:后三位可以直接快速幂取模,然后前三位可以有两种做法,一个是利用double,一个是利用公式法,具体看代码吧注意,后三位不足三位要补0,即用%03dAC代码①:#include #include #include #include #include #include #include #include #

2015-04-28 00:25:18 914

原创 Codeforces Round #300 (A,B,C,D)

题目传送:Codeforces Round #300A. Cutting Banner思路:一看题就会错意了,然后一顿猛敲,果不其然的被hack了,然后才发现只需要剪中间那一段就可以了,然后又傻逼得少写一个等号,还是被hack了,心累啊AC代码:#include #include #include #include #include #in

2015-04-27 17:29:05 1106

原创 BestCoder Round #39 (HDU5210,5211,5212)

题目传送:HDU - 5210HDU - 5210 - Delete思路:简单题AC代码:#include #include #include #include #include #include #include #include #include #include #include #include #define LL long

2015-04-26 23:12:08 649

原创 SGU - 106 - The equation (扩展欧几里得)

题目传送:106. The equation106. The equationtime limit per test: 0.25 sec. memory limit per test: 4096 KBThere is an equation ax + by + c = 0. Given a,b,c,x1,x2,y1,y2 you must det

2015-04-26 13:22:31 1248

原创 UVA - 10006 - Carmichael Numbers (快速幂+素数判断)

题目传送:UVA - 10006思路:就是快速幂暴力过去就行了,然后要注意点细节,就是快速幂的时候会爆int,然后就是先判断是否为素数,是素数就直接输出结果is normal,不然会超时AC代码:#include #include #include #include #include #include #include #include

2015-04-26 10:35:48 787

原创 UVA - 138 - Street Numbers (简单数论)

题目传送: UVA - 138思路:题意好难懂,看了半天,还是搜了题解才搞懂题意,真是给英语跪啦m在家的位置,而n是最后一个位置,直接输出前10组满足1~m-1的和 == m+1 ~ n的和,这是题意;然后通过题意可以得到n*(n+1)/2 - m - m*(m-1)/2 = m*(m-1)/2;化简可得2*m*m = n*(n+1);然后可以通

2015-04-26 00:19:03 721

原创 POJ - 2752 - Seek the Name, Seek the Fame (KMP-打印前缀后缀长度)

题目传送:POJ - 2752思路:就是每次都去找当前串的最大相同前缀后缀,找到一个后,令该相同前缀后缀为当前串,再循环调用,注意因为kmp的next函数中的最大相同前缀后缀不包含自身,所以每次都要多输出原串自身长度AC代码:#include #include #include using namespace std;const int maxn = 1000

2015-04-24 09:34:40 719

原创 POJ - 2406 - Power Strings (字符串求周期--next函数的妙用)

题目传送:POJ - 2406思路:就是利用kmp中next数组的特性来求最大周期的AC代码:#include #include #include using namespace std;const int maxn = 1000005;char s[maxn];int next[maxn];int main() { while(scanf(

2015-04-24 09:10:28 725

原创 zzuli - 第七届校赛

题目传送:“玲珑杯”第七届郑州轻工业学院ACM程序设计大赛——正式赛先给出我自己看了的题的题解吧A - 彩票水题AC代码:#include #include #include using namespace std; int main() { int T, N; scanf("%d", &T);

2015-04-22 20:53:32 944

原创 UVA - 10192 - Vacation (LCS)

题目传送:UVA - 10192思路:就是简单的最长公共子序列啦,不过输入居然还包含空格,然后很奇怪的TLE了,不是WA,心想n最大才100居然TLE,,好吧,可能有些数据特殊吧AC代码:#include #include #include using namespace std;char s1[105], s2[105];int dp[10

2015-04-20 23:41:04 702

原创 UVA - 116 - Unidirectional TSP (简单DP + 打印路径)

题目传送: UVA - 116思路:可以定义状态为dp[i][j] 为从第i行第j列开始往后走到第n列(总共n列)的最小值(赋初始值为无穷),且状态方程很好推出来:dp[i][j] = a[i][j] + max(dp[i-1][j+1], dp[i][j+1], dp[i+1][j+1]);    最后最优解  ans = max(dp[i][1])(1不过这题难点不在这

2015-04-20 20:53:16 685

原创 UVA - 11234 - Expressions (栈和队列)

UVA - 11234ExpressionsTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescription2007/2008 ACM International Collegiat

2015-04-18 22:04:09 887

原创 UVA - 10004 - Bicoloring (简单图论-着色判断)

UVA - 10004BicoloringTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescription  Bicoloring In 1976

2015-04-18 20:16:48 869

原创 HDU - 1532 - Drainage Ditches && 3549 - Flow Problem (网络流初步)

Drainage DitchesTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10875    Accepted Submission(s): 5131Problem DescriptionEvery ti

2015-04-17 23:37:01 662

原创 Codeforces Round #299 (Div. 2) -- (A,B,C)

题目传送:Codeforces Round #299 (Div. 2)A. Tavas and Nafastime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

2015-04-15 08:23:15 1165

原创 数据结构 - 树(基础)

1、无根树转有根树#include #include #include #include #define LL long long#define INF 0x7fffffff#include using namespace std;const int maxn = 1000005;int p[maxn];int n;int root;vector G[maxn];

2015-04-14 22:49:37 707

原创 ZZUOJ - 10377 - squee_spoon and his Cube III (DP)

10377: squee_spoon and his Cube IIITime Limit: 2 Sec  Memory Limit: 128 MBSubmit: 70  Solved: 22[Submit][Status][Web Board]Description    As we all know, pupil squee_spoon plays Rubik'

2015-04-13 21:13:32 659

原创 Codeforces Round #298 (Div. 2) -- (A,B,C)

题目传送:Codeforces Round #298 (Div. 2)A. Examtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

2015-04-13 20:22:08 768

原创 ZZU - 比赛(2015/4/12)

Problem B: 零比特填充-透明传输Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 93  Solved: 27[Submit][Status][Web Board]Description      在计算机网络中为了实现协议的透明传输,需要使用到一种差错检测的方法(零比特填充)。方法具体实现为:   

2015-04-12 23:49:08 782

原创 UVA - 11464 - Even Parity

11464 Even ParityWe have a grid of size N × N. Each cell of the grid initially contains a zero(0) or a one(1). The parityof a cell is the number of 1s surrounding that cell. A cell is surrounded b

2015-04-11 23:46:09 482

原创 HDU - 5202 - Rikka with string (DFS)

Rikka with stringTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 214    Accepted Submission(s): 109Problem DescriptionAs we know

2015-04-11 23:45:19 1118

原创 蓝桥杯 - 2的次幂表示 (递归)

题目传送:蓝桥杯 - 2的次幂表示思路:这递归递的我头都晕了,先贴个伪递归吧AC代码:#include #include #include using namespace std;void fun1(int a) { //输出2的a次方,因为题目最大就20000,2的15次方足以 if(a == 0) printf("2(0)"); else if(a

2015-04-10 00:21:16 851

原创 蓝桥杯 - 区间k大数查询

题目传送:蓝桥杯 - 区间k大数查询思路:取出来排个序即可AC代码:#include #include #include using namespace std;int n, m;int a[1005];int main() { while(scanf("%d", &n) != EOF) { for(int i = 1; i <= n; i++)

2015-04-09 21:39:58 569

原创 蓝桥杯 - 安慰奶牛 (最小生成树)

题目传送:蓝桥杯 - 安慰奶牛思路:先算好边的权值,为本来的边的权值的两倍加上两个点的权值,再进行kruskal,因为边数较大,不宜采用primAC代码:#include #include #include #include using namespace std;#define LL long long#define INF 0x7ff

2015-04-09 15:07:46 1098

原创 ZeptoLab Code Rush 2015 -- (A,B,C)

A. King of Thievestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn this problem you will meet the simplif

2015-04-05 16:56:04 1007

原创 HDU - 5200 - Trees (upper_bound)

TreesTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 205    Accepted Submission(s): 68Problem DescriptionToday CodeFamer is goin

2015-04-04 23:34:06 822

原创 某训练 - 猫和老鼠 - 模拟

猫和老鼠【题目描述】猫和老鼠在10*10 的方格中运动,例如: *...*..... ......*... ...*...*.. .......... ...*.C.... *.....*... ...*...... ..M......* ...*.*.... .*.*...... C=猫(CAT) M=老鼠(MOUSE)

2015-04-04 21:52:29 1610

原创 HDU - 5198 - Strange Class && 5199 - Gunner

Strange ClassTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 74    Accepted Submission(s): 60Problem DescriptionIn Vivid’s schoo

2015-04-04 21:47:18 830

原创 UVA - 10716 - Evil Straw Warts Live (简单模拟)

UVA - 10716Evil Straw Warts LiveTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionProblem D: Evil Straw Warts

2015-04-02 23:55:36 822

原创 UVA - 108 - Maximum Sum (简单贪心)

UVA - 108Maximum SumTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionBackgroundA problem that is simple

2015-04-02 22:28:59 956

原创 UVA - 993 - Product of digits (简单贪心)

993 Product of digitsFor a given non-negative integer number N, find the minimal natural Q such that the product of alldigits of Q is equal N.InputThe first line of input contains one po

2015-04-01 23:20:41 546

原创 UVA - 10487 - Closest Sums (二分求解)

传送:UVA - 1048710487 Closest SumsGiven is a set of integers and then a sequence of queries. A query gives you a number and asks to finda sum of two distinct numbers from the set, which is

2015-04-01 22:27:55 635

数据结构习题集严蔚敏

严蔚敏数据结构题集 C语言版 答案 简述下列术语:数据 数据元素 数据对象 数据结构 存储结构 数据类型和抽象数据类型

2015-01-13

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除