自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

z245527922的专栏

♪(^∇^*)

  • 博客(36)
  • 资源 (3)
  • 收藏
  • 关注

转载 扩展欧几里得

poj 1061 青蛙的约会(数论)2009-09-03 17:27:31 分类: http://acm.pku.edu.cn/JudgeOnline/problem?id=1061Memory: 224K Time: 16MS解题思路题意:    略  思路:   根据题意,两个青蛙跳到同一个点上

2015-07-11 14:14:54 323

转载 并查集

The SuspectsTime Limit: 1000MS Memory Limit: 20000KTotal Submissions: 17242 Accepted: 8319DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia

2015-07-09 16:32:18 313

转载 Number of Containers(数学)

Number of ContainersTime Limit: 1 Second Memory Limit: 32768 KBFor two integers m and k, k is said to be a container ofm if k is divisible by m. Given 2 positive integers n and m (m n)

2015-07-07 23:42:16 700

转载 HDU 1272 小希的迷宫(并查集)

Description 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计

2015-07-07 23:38:16 252

原创 Largest Rectangle in a Histogram(单调栈)

Description A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the

2015-07-07 23:23:34 390

原创 Red and Black(BFS or DFS)

Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles.

2015-07-05 22:52:33 246

原创 Eight(South Central USA 1998)(八数码)

The 15-puzzle has been around for over 100 years; even if you don’t know it by that name, you’ve seen it. It is constructed with 15 sliding tiles, each with a number from 1 to 15 on it, and all packed

2015-07-05 22:34:30 611

转载 printf "%.*s"

小数点.后“*”表示输出位数,具体的数据来自参数表printf格式字符串中,与宽度控制和精度控制有关的常量都可以换成变量,方法就是使用一个“*”代替那个常量,然后在后面提供变量给“*”。同样,小数点.前也可以添加*,也要用户输入一个位宽值来代替,表示输出的字符所占位宽。#include #include int main(){ char *s = "th

2015-07-04 14:36:28 367

原创 负数取模

在ipython下得出的数据: In [1]: -1%4 Out[1]: 3 In [2]: 1%(-4) Out[2]: -3 In [3]: -1%(-4) Out[3]: -1 个人理解:a%b=r中,若a和b中有一个为负数,则|r|=|b|-|a|%|b|;若b为负数,则r为负数;若a和b都为负数,则r=-|a|%|b| 。 方法2:用数轴看,例如-1%3,将3看成一个阶且它

2015-07-04 14:11:12 389

原创 Rightmost Digit(快速幂+数学知识OR位运算)

C - Rightmost Digit Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1061Description Given a positive integer N, you should output the most rig

2015-07-03 14:56:18 363

转载 Can you find it?

Description Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+Ck = X.Inp

2015-06-10 19:55:04 349

转载 PIE(二分)

PieTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 109 Accepted Submission(s): 52 Problem DescriptionMy birthday

2015-06-07 15:46:25 264

转载 容斥原理

Description Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integers in the set. For example, N=12, a

2015-06-06 22:59:49 246

原创 Monthly Expense(二分)

DescriptionFarmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤ moneyi ≤ 10,0

2015-06-06 00:31:37 427

原创 Skiing

Description Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22

2015-05-23 22:20:43 304

原创 悼念512汶川大地震遇难同胞――珍惜现在,感恩生活

Description 急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。 请问:你用有限的资金最多能采购多少公斤粮食呢?后记: 人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。 月有阴晴圆缺,人有旦夕祸福,未来对于我

2015-05-21 10:50:32 315

转载 hdu 1010 Tempter of the Bone 深搜+剪枝

Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionThe doggie foun

2015-05-04 22:12:12 290

转载 Sum It Up

Description Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For example, if t=4, n=6, and the list is [4,3,2,2,1,1], then there

2015-05-03 14:53:44 310

原创 A Knight's Journey

A Knight’s Journey Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 34085 Accepted: 11621Description Background The knight is getting bored of seeing the same black and white

2015-05-03 14:51:12 299

原创 文章标题

Description 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 creates a grid tha

2015-04-29 21:41:17 296

原创 Prime Ring Problem

Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Note

2015-04-27 17:00:32 288

原创 变形课

Description 呃……变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒语的一个统一规律:如果咒语是以a开头b结尾的一个单词,那么它的作用就恰好是使A物体变成B物体. Harry已经将他所会的所有咒语都列成了一个表,他想让你帮忙计算一下他是否能完成老师的作业,将一个B(ball)变成一个M(Mouse

2015-04-27 16:48:59 315

原创 畅通工程再续

difficuty:并查集 任意两点边按权值(即距离)排序 Description 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之

2015-04-23 23:16:13 293

原创 继续畅通工程

还是畅通工程【Difficulty】:并查集 结构体数组的快排 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input 测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );

2015-04-19 22:44:54 342 1

转载 文章标题

1111111111111111111 #include<stdio.h>#include<string.h>int main(){ int T,i,n,no,cnt,mCnt; char name[21],mName[21]; scanf("%d",&T); while(T--){ mCnt=-1; *mName=0;

2015-03-30 00:38:08 250

转载 对数的应用

对一个数num可写为 num=10n * a,即科学计数法,使a的整数部分即为num的最高位数字,numnum=10n * a这里的n与上面的n不等两边取对数: num*lg(num) = n + lg(a);∵a∴0设x=n+lg(a)→ n为x的整数部分,lg(a)为x的小数部分∵x=num*lg(num);∴a=10(x-n)=10(x-i

2015-02-08 17:30:39 367

转载 并查集(基础)(关于集合相加)

Mr Wang wants some boys to help him with a project. Because the project is rather complex,the more boys come, the better it will be. Of course there are certain requirements.Mr Wang selected a

2015-02-07 19:55:41 394

转载 relay

scanf函数是以在输入多个数值数据时,若格式控制串中没有非格式字符作输入数据之间的间隔,则可用空格,TAB或回车作间隔。C编译在碰到空格,TAB,回车或非法数据(如对“%d”输入“12A”时,A即为非法数据)时即认为该数据结束。getchar函数getchar 由宏实现:#define getchar() getc(stdin)。getchar有一个int型的返回值.当程序调用getch

2015-02-05 21:00:39 319

原创 char a[100][100] 定义字符串数组

#include#include#include#include#include#include#include using namespace std;char a[100][100];int main(){int n,x,m,s;char h;scanf("%s",a[0]);//输入234coutcoutreturn 0;}

2015-02-05 17:53:04 2260

转载 hdu2574 Hdu Girls' Day

#include#includeint main(){    int T,i,n,no,cnt,mCnt;    char name[21],mName[21];    scanf("%d",&T);    while(T--){        mCnt=-1;        *mName=0;        scanf("%d",&n);       

2015-02-04 20:57:57 523

原创 关于在计算中乘法溢出Calculate S(n)

A - Calculate S(n)Time Limit:1000MS    Memory Limit:32768KB    64bit IO Format:%I64d & %I64uSubmitStatusDescriptionCalculate S(n). S(n)=1 3+2 3 +3 3 +......+n 3 .   Input

2015-02-02 13:10:19 513

转载 数塔

max函数在C++#include中 可以直接调用#include#include#include#include#includeusing namespace std;int n;int a[1000][1000],dp[1000][1000];void solve(){    int i,j;    memset(dp,0,sizeof(dp

2015-01-30 17:02:24 307

原创 关于数字和字符之间的加减

#include #includeint main(){    int  e, i, o, u,n;    char a,b;    a='6';    b='0';    printf("%d %d\n",a,b);//  '6'对应的ASCII码是54,'0'对应的ASCII码是48;    printf("%d\n",a-b);    printf("

2015-01-27 12:53:04 3240

原创 最大公约数与最小公倍数

#include  求最小公倍数一种办法通过求最大公约数求得 再通过公式(最小公倍数=两个数的乘积/最大公约数)最大公约数 通过辗转相除法求得。#include  int Gcd (int a, int b){    int tmp;     while (b != 0){        tmp = a;        a = b;       

2015-01-23 11:20:10 298

转载 并查集

#includeint pre[1000 ];int find(int a){   if(pre[a]==a)       return a;    else       return pre[a]=find(pre[a]);}//int find(int x) {//int r=x;//while (pre[r ]!=r)//r=pre[r ]

2015-01-23 11:16:34 292

转载 dfs

#includeusing namespace std;int a[10]={5,9,-6,14,56,43,-23,9,4,8};int ans[1000000];int k=6;int x=93;int n=10;void dfs(int now,int snum,int s){   if(x==s&&snum==k)    {       fo

2015-01-23 11:14:49 237

Android数据库信息显示在listview上

Android数据库信息显示在listview上

2016-04-15

开机自启通知

开机自启通知

2016-04-05

JAVA车票管理系统(简单GUI)

JAVA车票管理系统(简单GUI)

2016-03-15

空空如也

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

TA关注的人

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