自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(46)
  • 收藏
  • 关注

原创 poj 2886 Who Gets the Most Candies? (线段树单点更新应用)

poj 2886 Who Gets the Most Candies? DescriptionN children are sitting in a circle to play a game.The children are numbered from 1 to N in clockwise order. Each of them has a card with

2014-12-30 21:42:16 597

原创 uva 12299 RMQ with Shifts(线段树单点更新初步应用)

uva 12299 RMQ with ShiftsIn the traditional RMQ (Range Minimum Query) problem, we have a static array A. Then for each query (L, R) (LR), we report the minimum value among A[L],A[L + 1],

2014-12-29 23:19:30 456

原创 HDU 1166 敌兵布阵(线段树的初步应用2)

HDU  1166  敌兵布阵DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少

2014-12-28 22:45:52 444

原创 uva 10061 How many zero's and how many digits ?(在不同进制下分解因子)

uva 10061 How many zero's and how many digits ?Given a decimal integer number you will have to find out how many trailing zeros will be there in its factorial in a given number system and also

2014-12-28 19:31:33 549

原创 HDU 1754 I Hate It(线段树初步应用)

HDU  1754  I Hate ItDescription很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。   Input本题目包含多组测试,请处理

2014-12-28 19:26:38 531

原创 uva 156 Ananagrams(字符串+STL应用)

uva 156 AnanagramsMost crossword puzzle fans are used to anagrams--groups of words with the same letters in different orders--for example OPTS, SPOT, STOP, POTS and POST. Some words however do

2014-12-28 13:20:56 474

原创 uva 548 tree

uva 548 treeYou are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value of a p

2014-12-27 17:54:43 543

原创 uva 657 The die is cast

uva 657 The die is castInterGames is a high-tech startup company that specializes in developing technology that allows users to play games over the Internet. A market analysis has alerted them to

2014-12-27 10:47:52 557

原创 uva 112 Tree Summing

uva 112 Tree SummingBackgroundLISP was one of the earliest high-level programming languages and, with FORTRAN, is one of the oldest languages currently being used. Lists, which are the fun

2014-12-26 17:17:15 811

原创 uva 572 Oil Deposits

Oil Deposits The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creat

2014-12-25 22:21:58 485

原创 uva 127 ``Accordian'' Patience

uva 127 ``Accordian'' Patience题目大意:一份扑克,52张牌(分两行),从左到右排列,输入‘#’为结束。扑克从左到右考虑,对于每张牌,如果左边第三牌或左边第一张(优先考虑左边第三张)有花色或数字一样,就将该牌移动到那张牌的上面。输出最后剩余的牌堆数,并输出每个牌堆的扑克牌数。注:1、移动后的牌堆,只考虑最上面一张,只有上面一张移动后,下面

2014-12-25 19:28:12 527

原创 uva 10970 Big Chocolate

uva 10970 Big Chocolate    题目大意:求将一个N* M的巧克力分成1 * 1的小块最少切几刀。解题思路:注满水的巧克力。#includeint main() { int a, b; while (scanf("%d %d\n", &a, &b) != EOF) { printf("%d\n", a * b - 1); }

2014-12-24 21:26:06 514

原创 uva 10387 Billiard

uva 10387 Billiard题目大意:有一个长为a宽为b的桌子,现在在桌子的中心放一小球,开始时小球的速度与水平方向有一个夹角,小球在s时间内在水平方向上与桌子相撞了n次,在垂直方向上与桌子相撞了m次,现在要求小球与水平方向所成的角度和速度大小。解题思路:分解球的运动路线,分解为水平的和垂直的,每碰撞一次水平(垂直),在水平(垂直)上就移动了a(b)。所以运动的总路程为 s

2014-12-24 21:11:44 543

原创 uva 10106 Product

uva 10106 Product题目大意:两个数求积。解题思路:高精度乘法,要注意因子为0的时候,思想跟高精度加法差不多。#include#includeint main() { int c = 0; char s1[1000], s2[1000]; char a[1000], b[1000]; memset(a, 0, sizeof(a)); memset

2014-12-24 19:50:36 540

原创 uva 424 Integer Inquiry

uva 424 Integer Inquiry题目大意:多个数求和,很大的数哦。解题思路:高精度加法,注意进位,注意把字符当做数字处理要减去    '0'。#include#includeint main() { char s1[1000], s2[1000]; char a[1000], b[1000]; memset(s1, 0, sizeof(s1)

2014-12-24 14:53:52 499

原创 uva 10194 Football (aka Soccer)

uva 10194 Football (aka Soccer)题目大意:给出一场足球比赛(记得名称),有n个球队,m次对抗,(team 1#进球数@进球数#team 2),任务,输出球队排名,按照:1、得分数;2、获胜场次;3、最大净进球;4、最多进球;5、最少比赛;6、队名的字典序(无大小写区别);输出:队名 得分p 场次g, (获胜-平局-失败),

2014-12-23 23:19:43 602

原创 uva 10392 Factoring Large Numbers

uva 10392 Factoring Large Numbers题目大意:将一个数分解成最小的因子。解题思路:想不到什么好办法 , 就用最笨的办法 , 然后过了 , 不要学我.#include#includeint main() { long long N; while (scanf("%lld", &N) != EOF, N > 0) { lon

2014-12-23 18:21:07 428

原创 uva 350 Pseudo-Random Numbers

uva 350 Pseudo-Random Numbers题目大意:给出z、l、m、i,根据公式l = (z * l + i ) % m,问l形成的循环有多少数。解题思路:只要注意形成的循环第一个元素不一定是原先的l,没什么难度,但是因为格式WA了两次  orz。   再一次证明了格式的重要性。#include#includeint main(){ int cnt2

2014-12-23 16:49:06 646

原创 uva 123 Searching Quickly

uva 123 Searching Quickly题目大意:给出一些ignore word(可忽略单词),再给出一些title,title由可忽略单词和不可忽略单词组成, 要求找出所有的不可忽略单词,输出含不可忽略单词的title(此时不可忽略单词要大写),注意一个不可忽略单词可能出现在多个title里,一个title可能有多个(包括相同的)不可忽略单词(输出时按照不可忽略单词的字典序

2014-12-22 13:07:39 472

原创 uva 10815 Andy's First Dictionary

uva 10815 Andy's First Dictionary题目大意:把所有单词按字典序排列,重复的输出一次。解题思路:注意sort的用法.#include #include #include using namespace std;struct S { char str[201]; }; S s[50000];int

2014-12-20 22:32:33 408

原创 uva 10010 Where's Waldorf?

uva 10010 Where's Waldorf?题目大意:给出一个网状字符串组,查找所给的字符串,输出第一个字符的坐标(可以向八个方向延伸)解题思路:DFS。 #include #include using namespace std; #define N 55 cha

2014-12-19 23:03:56 487

转载 发布的QT程序无法连接数据库的问题

发布的QT程序无法连接数据库的问题在windows下编译好的QT程序在其他没有安装QT的机器上会出现无法连接数据库的问题。       这时我们可以通过以下方式来解决:        在release文件夹里创建plugins文件夹,并将QT安装目录下的plugins\sqldrivers文件夹复制到release\plugins文件夹(我的程序使用的是SQLite数据

2014-12-19 22:14:20 2316

原创 uva 10878 Decode the tape

uva 10878 Decode the tape 题目大意:题意很重要,每一行对应一个字符,o带表1,其他符号代表0,组成的字符的ASCLL码。解题思路:每读取一行数据,对数据进行处理输出字符。(注意‘|’要处理,格式为(00000.000))#include#includeint ASCLL(int a) { //格式为|00000.000|

2014-12-19 20:35:28 462

原创 uva 409 Excuses, Excuses!

uva 409 Excuses, Excuses!题目大意:给出一些借口,再给出一些句子。输出包含最多借口的句子。注意:有1个以上并列最多时,按输入顺序输出。借口不能为句子中单词的子串,这样时非法的,例如:1 2caowo caowocao输出:wo cao解题思路:借用strstr,判断时要判断strstr返回的地址的后k(当前借口的长度)位或前一位是

2014-12-19 13:31:13 456

原创 uva 537 Artificial Intelligence?

uva 537 Artificial Intelligence?题目大意:在一个字符串中P、U、I中任意两个值,求另外一个值。解题思路:水题,匹配赋值,得解(注意数值后面的前缀)#include#include#includeint main() { int cnt; int cnt4 = 1; scanf("%d\n", &cnt); while (cnt-

2014-12-19 13:29:03 582

原创 uva 10014 Simple calculations

uva 10014 Simple calculations   题目大意:给出一个数列的首项、 末项,和中间常量,根据公式ai = (ai–1 + ai+1)/2 – ci ,求a1项。解题思路:公式可化简成ai  -   ai-1   = ai+1   -    ai     - 2 * ci,   ai+1 - ai = ai+2 - ai+1 - 2 *ci+1

2014-12-15 17:51:11 503

原创 uva 401 Palindromes

uva 401 Palindromes题目大意:判断一个字符串是不是回文、镜像字符串。解题思路:逐一判断。PS:注意!!格式!!少个空格害死人!!O和0是相等不是镜像!!!#include#includeint main() { char ch[200], flag1 = 0, flag2 = 0,flag3 = 0; while (scanf("%s", ch)

2014-12-14 23:53:43 437

原创 uva 10719 Quotient Polynomial

uva 10719 Quotient Polynomial题目大意:多项式求除法商,就是将多项式分解成p(x) = (x - k) * q(x), 求q(x)各项的系数.解题思路:q(x)中除了最高次项的系数与p(x)最高项的系数相同,其它系数有一个规律q[i] = p[i] + k * q[i - 1].PS:注意数组大小……#include

2014-12-14 10:32:50 466

原创 uva 11044 Searching for Nessy

uva 11044 Searching for Nessy 题目大意:跳过一堆背景,就是求m*n的网格中能放最多几个3*3的正方形。解题思路:(m/3)*(n/3) #include int main(){ int n, m, t; scanf("%d", &t); while(t--){ scanf("%d%d"

2014-12-13 20:32:07 616

原创 uva 10790 How Many Points of Intersection?

uva 10790 How Many Points of Intersection?题目大意;告诉你两条线上的定点个数,将点与电间连线,求交点个数。解题思路:不解释。有规律#includeint main(){ int n1, n2, t = 1; while (scanf("%d%d", &n1, &n2), n1 || n2) {

2014-12-13 20:11:53 413

原创 uva 10499 The Land of Justice

uva 10499 The Land of Justice题目大意:求对一个球n等分之后多出的表面积是原来表面积的百分之几。解题思路:除了1为0%外, 其他都为25* n%.(公式)#includeint main() { long long n; while (scanf("%lld", &n), n > 0) { if (n == 1) {

2014-12-13 19:57:06 495

原创 uva 846 Steps

uva 846 Steps题目大意:给出两个数字, 要求从a走到b, 第一步和最后一步只能走1, 每步的值可以是前面一步值-1, 不变和+1.求a到b最少走几步。解题思路:1...k k ...1所需步为2 * k,2 * sum(1~k)  ->2 * k2 * sum(1~k)  ~2 *  sum(1~k) + 1 + k  -> 2 *k + 12 *

2014-12-13 17:08:23 559

原创 uva 573 The Snail

uva 573 The Snail题目大意:蜗牛爬井口的故事都听说过吧, 就是给出高度,第一天爬的距离,和晚上下滑的距离。还有一个百分数,*第一天爬的距离就是每天上升距离的下降值。解题思路:模拟啊(注意下降值是不变的)#includeint main() { int day; float H, h, U, D, F, f; while (scanf("%

2014-12-13 16:01:03 492

原创 uva 107 The Cat in the Hat

uva 107 The Cat in the Hat题目大意:有一只高H的猫, 要去打扫一个房间,但是它很懒惰, 就从帽子里变出N只猫来帮它干活, 变出来的N只猫的高度为原来那只猫的1 / (N + 1),`可是被变出来的N只猫也很懒惰, 也不想干活,同样从帽子里变出N只猫帮自己干活(注意,是1只变出N只, 不是总共N只),高度同样是原先的1 / (N + 1),.......直到小猫

2014-12-13 12:57:54 644

原创 uva 591 Box of Bricks

uva 591 Box of Bricks题目大意:把n堆砖移成相同高度需要移动多少块砖。解题思路:先求平均值,再用比平均值大的数减去平均值, 所有差的和就是所求值。#include#includeint main() { int sum, ave, num, brick[50], cnt=1; while(scanf("%d", &num) != EOF

2014-12-13 10:47:53 636

原创 uva 10025 The ? 1 ? 2 ? ... ? n = k problem

uva 10025 The ? 1 ? 2 ? ... ? n = k problem题目大意:给出一个数, 判断它需要从1~m(可用+、-)填充的算式求得。求m解题思路:首先, 1~m的和一定要 > n(如果全+都无法表示的话, 更别说有-)其次,找到一个m,使得1~m的和>n之后,因为sum >= n, 所以要减掉一个数, 比如在数字k前面加个-号, 相当于sum - 2 * k,也就是说

2014-12-13 09:51:30 646

原创 uva 621 Secret Research

uva 621 Secret Research 题目大意:就是解析所给数字哪种类型的。解题思路:无解的垃圾题。#include #include int main() { char a[500]; int n; scanf("%d", &n); while (n--) { memset(a, 0, sizeof(a)); scanf("%s"

2014-12-12 23:01:22 531

原创 uva 253 Cube painting

uva 253 Cube painting题目大意:判断两个正方题可否旋转得到。解题思路:只要每两个对面形成一组颜色对, 每个正方体有三个颜色对,匹配下颜色对是否相同。#include #include int main() { int vis[5], cnt = 0; char pain[20]; while (scanf ("%s", pain) !=

2014-12-12 17:51:14 604

原创 uva 10161 Ant on a Chessboard

uva 10161 Ant on a Chessboard 题目大意:找到数字对应的行和列。解题思路:找规律,奇数行,起始为行数的平方。偶数列,起始为列数的平方。行和列有与数字匹配的规律。    #includeint main(){ int N, n, cnt, x, y; while (scanf("%d", &N) != EOF && N) {/

2014-12-11 19:56:25 568

原创 uva 113 Power of Cryptography

Power of Cryptography   题目大意:k ^ n = q. 求n. 解题思路:double的上限是1.7e+308,完全够。 #include#includeint main(){ double n, p; while (scanf ("%lf%lf", &n, &p)!=EOF){ printf("%0.lf\n", pow(p,1.0

2014-12-11 16:54:47 532

空空如也

空空如也

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

TA关注的人

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