自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 暑期集训瞎BB

数列二分,前缀和,后缀和,树状数组

2016-08-07 19:49:45 1321 6

原创 自己写的各种可能会用到的东西

fill(a,a+n,num) 用于对一维数组做全部赋值vector< int > G[max] 实现领接表 G.push_back(t) 置入元素G[i][j] 对领接表后的某些数取出G[i].size() 这个vector的大小struct edge { int to; //int cost; }; vectorG[max]; // 领接表的实现typedef pair

2016-03-27 13:33:45 326

转载 POJ刷题顺序

1000 A+B Problem 0.55 188072 338977 1004 Financial Management 0.41 58282 140301 1003 Hangover 0.48 50457 103742 1002 487-3279 0.17 43922 247299 1005 I Think I Need a Houseboat 0.43 38343 88354 100

2016-03-27 12:34:03 10703

原创 模板

题目连接:DescriptionInputOutputSample InputSample OutputHint题意题解:代码

2016-01-03 19:27:23 269

原创 Cf div2 338 D [费马小定理]

题目连接http://codeforces.com/contest/615/problem/DDescriptionAyrat has number n, represented as it’s prime factorization pi of size m, i.e. n = p1·p2·…·pm. Ayrat got secret information that that the produ

2016-09-08 13:17:57 409

原创 Cf 361div2 C [二分]

题目连接http://codeforces.com/contest/689/problem/CDescriptionBad news came to Mike’s village, some thieves stole a bunch of chocolates from the local factory! Horrible!Aside from loving sweet things, thie

2016-08-30 23:49:48 446

原创 8.26组队赛

补了差不多5个题,先把4个题的题解先写了。。。我感觉再不写,过几天更不会写了。。。男神的演唱会 XDOJ 1060题目链接http://acm.xidian.edu.cn/problem.php?id=1160题解每个人每个时间段都有一个可能的不同状态,可能在也可能不在,对于每个询问,我们维护当前在听演唱会的这么一个人的集合,在线查询的,按照时间,依次往后推移。代码#include<iostream

2016-08-30 01:03:10 1994

原创 8月11日 集训测试

B题目链接http://acm.hust.edu.cn/vjudge/problem/24840题意给出一个天枰的文字描述,问最少修改多少次可以使天枰的所有支点都是平衡的。题解找一个基准(depth*weigh),把其他所有的重量的基准都修改为这个值,那么只要这个基准的出现次数最多,那么修改的次数也就越少。sum-基准次数。代码#include<iostream>#include<queue>

2016-08-15 16:19:49 319

原创 动态规划

流水线调度问题简单描述 两条流水工作线,问怎样处理一个工件,使花费的时间最少。题解简单而典型的动态规划问题,对一个单独的处理站而言,到这个站为止最少的处理时间为 f1[n]=min(f1[n-1]+cost1[n],f2[n-1]+waycost[n-1]+cost1[n]),(waycost指的是中途从二号线转到一号线所花费的时间,cost1[n]指的是在一号线上第n个处理站处理这个工件所花费的

2016-08-10 20:57:30 331

原创 POJ3723 招募士兵[最小生成树]

题目连接http://poj.org/problem?id=3723DescriptionWindy has a country, and he wants to build an army to protect his country. He has picked up N girls and M boys and wants to collect them to be his soldiers.

2016-08-09 19:41:43 704

原创 克鲁斯卡尔[最小生成树集锦]

题目链接HDU1879http://acm.hdu.edu.cn/showproblem.php?pid=1879题解状态是1的两个分量直接联通,然后套模板。##include<iostream>#include<queue> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include

2016-08-09 13:47:16 331

原创 bestcoder 86 A B C

A题目链接http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=721&pid=1001题解计算每个商店各买一个所需的最多的钱,然后和每天记录的钱比较。代码#include<iostream> #include<cstdio> #include<cstring> #include<string> #in

2016-08-07 19:48:09 294 4

原创 Cf 362div2 C [map暴力,思维能力]

题目连接http://codeforces.com/contest/697/problem/CDescriptionBarney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional roa

2016-08-06 10:34:36 339

原创 Cf 362div2 B[Java高精度,scanf数据读入]

题目连接http://codeforces.com/contest/697/problem/BSample Input8.549e2Sample Output854.9题意给出一个科学记数法表示的数,将其转换为一般的数并输出。题解输出没有前导0,没有后缀0,0.0e0这种数据输出是0。其实说了这么多Java分分钟搞定。。。。我特么也是服了,用c写了半天WA得都要哭了,c的代码就不上了。值得一提用c对

2016-08-05 16:33:59 461

原创 Java 高精度BigDecimal[科学记数法的补充]

原文链接http://blog.csdn.net/wang371756299/article/details/8274637正文BigDecimal是处理高精度的浮点数运算的常用的一个类当需要将BigDecimal中保存的浮点数值打印出来,特别是在页面上显示的时候,就有可能遇到预想之外的科学技术法表示的问题。一般直接使用 BigDecimal.toString()方法即可以完成浮点数的打印。如:Sy

2016-08-05 16:24:51 459

原创 Java在ACM中的一些运用

原文链接http://blog.csdn.net/lin375691011/article/details/18798425包括进制转换,格式输入输出,大数,高精度。感觉特别有用

2016-08-05 16:08:11 302

原创 POJ 1611非典传染[并查集]

题目连接http://acm.hust.edu.cn/vjudge/problem/10536Sample Input100 4 2 1 2 5 10 13 11 12 14 2 0 1 2 99 2 200 2 1 5 5 1 2 3 4 5 1 0 0 0Sample Output4 1 1题意0号学生是,非典传染源,与他同组的学生都有感染非典的嫌疑,找出所有有嫌疑的学生。

2016-08-05 10:01:28 455

原创 Hdu 5775模拟冒泡[树状数组]

题目连接http://acm.hust.edu.cn/vjudge/problem/435522DescriptionP is a permutation of the integers from 1 to N(index starting from 1). Here is the code of Bubble Sort in C++.for(int i=1;i<=N;++i) for(

2016-08-04 19:18:30 233

原创 POJ 2352[树状数组]

题目连接http://acm.hust.edu.cn/vjudge/problem/14610Sample Input5 1 1 5 1 7 1 3 3 5 5Sample Output1 2 1 1 0Hint数据量极大,建议不要用cin读入数据,用scanf读入。题意给出所有星星的坐标位置,问每个星星的左下方有多少个星星。题解题目数据的给定是按照x,y坐标递增给定的,不需要重新

2016-08-04 16:49:54 241

原创 Hdu 1053哈夫曼编码

题目连接http://acm.hdu.edu.cn/showproblem.php?pid=1053Sample InputAAAAABCD THE_CAT_IN_THE_HAT ENDSample Output64 13 4.9 144 51 2.8题意算普通编码的长度x,哈夫曼编码的长度y,以及x/y的值。题解普通编码长度字符数*8,哈夫曼编码用优先队列。。。奶奶的,我又把优先队列算哈夫曼

2016-08-03 01:37:40 363

原创 Cf 363div2 A B C

A题目链接http://codeforces.com/contest/699/problem/A题意有些粒子向左飞,有些粒子向右飞,问最先碰到一起的粒子的时间。题解虽然是水题,但还是考虑漏了一些东西,WA了两发…只有RL这种情况才可以碰到,R遇到R要更新,L遇到R要更新。[自己蠢了,只需要寻找相邻的RL组合即可,比较取最小值]代码#include<bits/stdc++.h>using names

2016-08-03 01:31:31 305

原创 Cf 364div2 D[数学公式推导]

题目连接http://codeforces.com/contest/701/problem/DDescriptionOn vacations n pupils decided to go on excursion and gather all together. They need to overcome the path with the length l meters. Each of the

2016-08-01 20:54:30 706

原创 Cf 364div2 [C.尺取法]

codeforces 364 Solutions For A B C

2016-08-01 14:11:33 220

原创 Hdu 5777多米诺[贪心]

题目连接http://acm.hust.edu.cn/vjudge/problem/440428Description小白在玩一个游戏。桌子上有n张多米诺骨牌排成一列。它有k次机会,每次可以选一个还没有倒的骨牌,向左或者向右推倒。每个骨 牌倒下的时候,若碰到了未倒下的骨牌,可以把它推倒。小白现在可以随意设置骨牌的高度,但是骨牌高度为整数,且至少为1,并且 小白希望在能够推倒所有骨牌的前提下,使所

2016-07-31 20:47:37 319

原创 Hdu5776 字串的和[鸽巢原理]

题目连接http://acm.hust.edu.cn/vjudge/problem/440424DescriptionGiven a sequence, you’re asked whether there exists a consecutive subsequence whose sum is divisible by m. output YES, otherwise output NO Inp

2016-07-31 19:11:16 222

原创 Uva400 [vector与字符串]

题目连接http://acm.hust.edu.cn/vjudge/problem/19295Sample Input19 Mr._French Jody Buffy Sissy Keith Danny Lori Chris Shirley Marsha Jan Cindy Carol Mike Greg Peter Bobby Alice RubenSampl

2016-07-31 15:12:53 378

原创 Cf Edu 15 C 城市与信号塔[二分]

题目连接http://codeforces.com/contest/702/problem/CDescriptionYou are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coor

2016-07-31 00:32:56 729

原创 Uva136 丑数[优先队列]

题目连接http://acm.hust.edu.cn/vjudge/problem/19437题意找出第1500个素因子只能有2或3或5的数。题解懵逼了吧,并不是素因子筛,用2,3,5去筛并不能得到满足丑数要求的数,例如14就筛不掉。优先队列每次取一个最小的数x,2x,3x,5x,都是丑数,但是每次要判断是否有重数(set),取1500,每次都是取出最小的数,取1500次之后就是第1500个数。代码

2016-07-30 22:48:41 835

原创 Uva540 队列与map

题目连接http://acm.hust.edu.cn/vjudge/problem/19518Sample Input2 3 101 102 103 3 201 202 203 ENQUEUE 101 ENQUEUE 201 ENQUEUE 102 ENQUEUE 202 ENQUEUE 103 ENQUEUE 203 DEQUEUE DEQUEUE DEQUEUE DEQU

2016-07-30 20:16:03 279

原创 CF Edu 15 B 求和二的幂次

题目连接http://codeforces.com/contest/702/problem/BDescriptionYou are given n integers a1, a2, …, an. Find the number of pairs of indexes i, j (i < j) that ai + aj is a power of 2 (i. e. some integer x exi

2016-07-30 11:28:29 814

原创 Uva156 map容器的使用 sortvecor And map.count

题目连接http://acm.hust.edu.cn/vjudge/problem/297728Sample Inputladder came tape soon leader acme RIDE lone Dreis peat ScAlE orb eye Rides dealer NotE derail LaCeS drIed noel dire Disk mace Rob drie

2016-07-30 09:57:13 256

原创 Uva10815 set容器的使用 stringstream ss

题目连接:http://acm.hust.edu.cn/vjudge/problem/18649Sample InputAdventures in Disneyland Two blondes were going to Disneyland when they came to a fork in the road. The sign read: “Disneyland Left.” So

2016-07-29 18:23:56 900

转载 Java大数类

原文:http://blog.csdn.net/niushuai666/article/details/6972991大数阶乘题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=28代码如下:import java.io.*; import java.math.BigInteger; import java.util.*; publi

2016-05-29 19:44:12 235

原创 XDOJ 万神的线段 重载运算符

题目连接http://acm.xidian.edu.cn/problem.php?id=1153Description一天,万神闲着无聊,画了 n 条线段。第 i 条线段有两个端点 (xi0,yi0), (xi1,yi1)。 因为被杜神坑过,万神非常讨厌浮点精度问题,因此这些端点的坐标都是整 数。 万神希望知道,有多少对线段互相平行,或者在同一条直线上(部分或全部 重合也算同一条直线上)Input输

2016-05-03 21:53:42 280

原创 CF 346 B vector<pair> s[100]

题目连接http://codeforces.com/contest/659/problem/BDescriptionVery soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participa

2016-04-10 10:52:47 281

原创 POJ 3258 小牛过河 二分搜索最大的最小值

题目连接http://poj.org/problem?id=3258DescriptionEvery year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement tak

2016-04-10 10:14:46 435

原创 POJ 1064 切绳子 二分搜索求一个可行解

题目连接http://poj.org/problem?id=1064DescriptionInhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the mo

2016-03-28 23:40:44 670

原创 最最简单的二分搜索

#include<bits/stdc++.h>using namespace std;#define max 1000typedef pair<int,int>p;#define INF 1e9+7#define ll long long#define eps 1e-6int main(int argc, char const *argv[]){ int a[5]={1,2

2016-03-28 23:29:31 190

原创 XDOJ An Old Problem 水水水

题目连接http://acm.xidian.edu.cn/problem.php?cid=1018&pid=0Description给定一个n*m的矩阵,要求支持下面的操作: 0 x y:交换第x行与第y行 1 x y:交换第x列与第y列Input多组数据。对于每组测试数据,第一行包含三个数n,m,k(1<=n,m<=1000;1<=k<=100000),分别表示行数,列数,操作数。 接下来n

2016-03-28 22:13:22 251

原创 CF Edu10 A

题目连接http://codeforces.com/contest/652/problem/ADescriptionThe 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the he

2016-03-27 22:48:11 229

空空如也

空空如也

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

TA关注的人

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