自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 L1-043. 阅览室

题目有坑,如果出现了两次借同一本书的操作,那么以后借的一次为开始时间。代码:#include<cstdio>#include<cstring>#include<cmath>int sta[1007];int n;char s[10];int time[1007];using namespace std;int coun,ave;int ca...

2018-03-26 20:45:23 172 1

原创 第一行代码 U1-U2

U1 使用log工具 log.d(“tag”,”msg”); tag为当前类,msg为要打印的具体内容 在代码中通过R.String.hello_world可以获得该字符串的引用 在XML中通过@String/hello_world可以获得该字符串的引用 定义一个资源名称@+String/hello_worldmatch_parent wrap_content U2 ctrl+o

2017-06-11 11:19:55 448

原创 pat L1-006. 连续因子

直接搜索因子。注意题干要求因子的乘积不大于n。输出最小的乘积的因子,即 如果没有连续的因数,那么输出最小的那个因数。代码#include<cstdio>#include<cstring>#include<iostream>#include<cmath>#include<map>#include<string>#include<algorithm>using namespace std;

2017-03-23 17:06:55 466

原创 L1-020. 帅到没朋友

我真是不知道为什么有人会想到并查集。。 大水题一个,直接遍历一下就好啦。 需要注意的是输出,每人对应一个ID号,为5位数字 即就是ID为1,输出为00001,而不是1#include<cstdio>#include<cstring>#include<vector>using namespace std;int vis[1000000];int main(){ int n;

2017-03-20 14:40:45 387

原创 C - 胜利大逃亡(续) HDU - 1429

C - 胜利大逃亡(续) HDU - 1429 #include<cstdio>#include<cstring>#include<queue>using namespace std;int n,m,t;char mp[100][100];struct data{ int x,y; int cost; int sta;}st,en;int dx[]={-1,0,1

2016-12-09 12:57:34 299

原创 HDU - 1253

HDU - 1253#include<cstdio>#include<queue>#include<cstring>using namespace std;int a,b,c,t;int mp[57][57][57];struct data{ int x,y,z; int cost; data(){cost=0;} data(int a,int b,in

2016-12-07 18:44:01 216

原创 poj1922

简单数学题#include<cstdio>#include<cmath>#include<algorithm>#include<cstring>using namespace std;int n;int main(){ while(scanf("%d",&n)!=EOF) { if(n==0) break; int a

2016-12-02 21:07:32 381

原创 poj1338

模拟。 注意模拟的方法,记录235分别上一次乘的数字。直接暴力会超时。#include<cstdio>#include<cmath>#include<algorithm>#include<cstring>using namespace std;int a[2000];int n;bool ok(int x){ int flag=1; while(flag) {

2016-12-02 19:59:57 239

原创 poj2196

利用海伦公式由海伦公式得出面积 s=sqrt(p*(p-a)(p-b)(p-c)) p=(a+b+c)/2;由三角形面积公式S=1/2*a*b*sin(C) 和正弦定理a/sin(A)=b/sin(B)=c/sin(C)=d=2*r 得d=a*b*c/2/S; (a,b,c为三边长)周长为d*PI#include<cstdio>#include<cmath>#include<al

2016-12-02 19:30:06 277

原创 poj3094

模拟#include<cstdio>#include<cmath>#include<algorithm>#include<cstring>using namespace std;char ss[10000];int main(){ while(gets(ss)) { if(ss[0]=='#') break; int

2016-12-02 19:01:23 195

原创 Humidexpoj3299

模拟。 注意输入为很多种情况,TD,TH,DH#include<cstdio>#include<cmath>#include<algorithm>#include<cstring>using namespace std;char s1[100],s2[100];double t,d,h;double a1,a2;double E=2.718281828;int vis[300];v

2016-12-02 18:46:52 290

原创 hdu4778 Gems Fight!

博弈+状态压缩。感觉其实更像是模拟整个操作过程,每一步都保证达到最优。 然后进行状态转移就好啦。 需要注意的是 数组开小了真的是什么错误都会报,T RE WA都可能出现。。#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int g,b,s;int dp[1<<21];int num[3

2016-10-30 12:48:01 265

原创 hdu 1043 eight

八数码 逆向dfs打表#include<cstdio>#include<algorithm>#include<cstring>using namespace std;char ss[100];int c[100];struct data{ int a[10]; int loc; int id; int fa; int di; data(){f

2016-10-04 14:06:50 181

原创 hiho#1050 : 树中的最长路

1050 : 树中的最长路经典算法。#include<cstdio>#include<algorithm>#include<vector>#include<cstring>using namespace std;int n;const int N=100007;vector<int>ve[N];int dis[N];int vis[N];void dfs(int now,int l

2016-09-21 21:25:09 277

原创 hiho#1055 : 刷油漆

hiho#1055 : 刷油漆树形dp的基础题。 注意理解成 分成很多个背包。 一个可以涂m个点的背包,可以拆分成可以涂m1,m2,m3….的背包#include<cstdio>#include<algorithm>#include<vector>#include<cstring>using namespace std;const int N=300;int n,m;int v[N

2016-09-21 21:24:12 370

原创 poj1170

poj1170 题意:给很多件商品,给出组合购买和单独购买的价格,要求求出购买指定种类指定数量的各类商品的最小花费。 思路:典型的背包问题,可以使用记忆化搜索的思路来写,比用for循环写简单得多。注意,方案不存在的话,返回 花费为无穷大。#include<cstdio>#include<iostream>#include<cstring>#include<map>#include<set

2016-08-22 19:46:23 566

原创 hdu3401

hdu3401 题意:给定t天的股票情况,要求出t天后最大的利润。 思路:单调队列优化dpTIP:可能出现一直不买股票,最终利润为0的最优情况。#include<cstdio>#include<iostream>#include<cstring>#include<map>#include<set>#include<algorithm>#include<sstream>#includ

2016-08-22 16:39:35 546

原创 整数划分(四)

整数划分(四) http://acm.nyist.net/JudgeOnline/problem.php?pid=746题意:给一个数字n,把这个数字划分成m段,求各段乘积的最大值。 思路:区间dp。 注意各个地方的下标。 枚举到第i次划分的时候,应该从j=i-1开始扫描,因为此时是i个数字划分成i段,如果数字个数小于i,那么这一段最终划分结果肯定是0,没有必要去枚举了。#include<c

2016-08-22 10:04:00 352

原创 Brackets Sequence poj1141

Brackets Sequence poj1141 题意:给一个括号串,要求输出增加最少的括号,使得整个括号串匹配后的括号序列。 思路:区间dp。记录路径的时候使用pos[i][j]数组,记录i到j中间的分割点,如果不用分割,那么记录为-1,否则是分割点的位置. 输出使用递归即可。 TIP:不要用scanf,会wa掉。用gets来读入。#include<cstdio>#include<io

2016-08-21 20:45:35 245

原创 pojBrackets

Bracketspoj2955 题意:给好多个括号,问最多能够匹配上多少个 思路:区间dp。 首先预处理长度为1,2的时候。 然后每次枚举一下中间的断点,找到使得dp[i][j]最大的点.#include<cstdio>#include<iostream>#include<cstring>#include<map>#include<set>#incl

2016-08-21 19:43:46 282

原创 poj2288

poj2288TIP: 注意分析好状态,这里用一个三维的数组表示,注意要另外开一个num数组。 n=1时候要注意特判。#include<cstdio>#include<vector>#include<cstring>#include<algorithm>using namespace std;typedef long long ll;int n,m;ll v[20];int mp[

2016-08-15 16:33:45 201

原创 hdu3001

hdu3001 题意: 给n个城市以及m条路。要求每个城市至多经过2次,求经过全部城市所需要的时间总花费是多少。 思路: 状态压缩。三进制进行压缩处理。可以提前处理好每个状态下每一位的情况。注意好下表细节,n个城市的话,状态的为0到bas[n]数组,即0到3的n次方(前闭后开)。 代码:includeincludeincludeincludeusing namespace std;int

2016-08-15 14:19:09 362

原创 hdu 3197

hdu 3197 题意: 给一棵树,两个人每次砍树干,最后没得砍的那个人输,试着判断谁输谁赢。TIP: 输入很坑,-1代表该点就在地上。 思路: 树形博弈,递归求解sg值即可。NIM博弈。 代码:#include<cstdio>#include<cstring>#include<cmath>#include<vector>#include<queue>#include<map>

2016-08-11 21:46:54 338

原创 HDU 3182-Hamburger Magi

HDU 3182-Hamburger Magi典型的状态压缩dp的题目。莫名其妙的出bug,之后又莫名其妙的AC。 我觉得dp数组开结构体比开数组存的信息更丰富。#include<cstdio>#include<iostream>#include<string>#include<algorithm>#include<cstring>using namespace std;typedef

2016-08-10 18:13:04 421

原创 hdu 3091

hdu 3091 细节好多。 注意题目要求的是一个环,所以默认把第0个珠子当成第一个珠子,最后加的时候,最后一颗要和0能够相连。#include<cstdio>#include<iostream>#include<string>#include<algorithm>#include<cstring>using namespace std;typedef long long ll;i

2016-08-10 15:12:29 376

原创 Doing Homework hdu1074

状态压缩。 注意输出要依照字典序。所以实际在写的时候要注意方向, 若果是每次枚举可以加的课程,那么此时从0到n, 否则每次枚举可以删掉的课程,那么此时从n到0进行枚举。#include<cstdio>#include<iostream>#include<string>#include<algorithm>#include<cstring>using namespace std;int

2016-08-10 14:04:47 309

原创 hdu2999Stone Game, Why are you always there?

Stone Game, Why are you always there?Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 726 Accepted Submission(s): 250Problem Description “Al

2016-08-10 14:01:40 347

原创 Paint Chainhdu3980

Paint ChainTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1741 Accepted Submission(s): 595Problem Description Aekdycoin and abcdxyzk are p

2016-08-06 19:44:25 227

原创 poj3761

Bubble Sort Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2708 Accepted: 922 DescriptionBubble sort is a simple sorting algorithm. It works by repeatedly stepping through the l

2016-07-31 09:35:49 266

原创 A计划hdu2102

A计划 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u SubmitStatus Description 可怜的fish在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的他再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉fish,因为他听信谣言说吃fish的肉也能长生不老。年

2016-07-26 09:27:47 216

原创 HDU 2181 哈密顿绕行世界问题

B - 哈密顿绕行世界问题 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u SubmitStatus Description 一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发的城市。 Input 前20行的第i行有3个数,

2016-07-25 19:00:09 203

原创 Hopscotch POJ3050

Hopscotch Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3284 Accepted: 2271 DescriptionThe cows play the child’s game of hopscotch in a non-traditional way. Instead of a linear

2016-07-25 11:05:42 238

原创 Backward Digit Sums POJ3187

Backward Digit Sums Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6223 Accepted: 3602 DescriptionFJ and his cows enjoy playing a mental game. They write down the numbers from 1

2016-07-25 10:32:11 423

原创 Smallest Difference poj2718

Smallest Difference Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8136 Accepted: 2232 DescriptionGiven a number of distinct decimal digits, you can form one integer by choosing

2016-07-24 21:20:54 187

原创 Meteor Showerpoj3669

Meteor Shower Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 15192 Accepted: 4003 DescriptionBessie hears that an extraordinary meteor shower is coming; reports say that thes

2016-07-24 19:03:44 341

原创 poj1979 Red and Black

A - Red and Black Time Limit:1000MS Memory Limit:30000KB 64bit IO Format:%lld & %llu SubmitStatusPracticePOJ 1979 Appoint description: Description There is a rectangular room, covered wit

2016-07-24 08:24:37 208

原创 Codeforces Beta Round #94 (Div. 1 Only)String

B. String time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output One day in the IT lesson Anna and Maria learned about the lexicographic order.St

2016-07-22 14:11:37 300

原创 CF 14 problem D - Two paths

D. Two Paths time limit per test2 seconds memory limit per test64 megabytes inputstandard input outputstandard output As you know, Bob’s brother lives in Flatland. In Flatland there are n cities,

2016-07-22 13:47:04 202

原创 文章标题

A. Xor-treetime limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Iahub is very proud of his recent discovery, propagating trees. Right now, he inv

2016-07-20 14:50:54 169

原创 Tower of Hanoi CodeForces 392B

B. Tower of Hanoi time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output The Tower of Hanoi is a well-known mathematical puzzle. It consists of th

2016-07-20 11:11:22 272

空空如也

空空如也

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

TA关注的人

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