- 博客(48)
- 资源 (2)
- 收藏
- 关注
原创 hdu 1796 How many integers can you find【二进制写容斥】
How many integers can you findTime Limit: 12000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8734 Accepted Submission(s): 2592Problem Description Now y
2017-07-31 17:44:38 272
转载 深度理解链式前向星
我们首先来看一下什么是前向星.前向星是一种特殊的边集数组,我们把边集数组中的每一条边按照起点从小到大排序,如果起点相同就按照终点从小到大排序,并记录下以某个点为起点的所有边在数组中的起始位置和存储长度,那么前向星就构造好了.用len[i]来记录所有以i为起点的边在数组中的存储长度.用head[i]记录以i为边集在数组中的第一个存储位置.
2017-07-31 12:59:36 244
原创 hdu 1695 GCD【容斥+欧拉】
GCD Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 9524 Accepted Submission(s): 3544Problem Description Given 5 integers: a, b, c, d, k,
2017-07-31 10:17:20 1165
原创 poj 2356 Find a multiple【抽屉原理】
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8197 Accepted: 3559 Special Judge DescriptionThe input contains N natural (i.e. positive integer) numbers ( N
2017-07-30 17:22:47 258
原创 玲珑杯 1149 - Buildings【线段树+尺取】
“玲珑杯”ACM比赛 Round #19题意: 给出n,k值,接下来一行是楼房的高度(序列不能排序),按照题中的公式求取满足条件的楼房对数; 思路: 本题无非是更新区间最大值,最小值,其次利用尺取的思想。每更新一个值(也就是r向前移动一位)就查询一次,满足条件时:sum += r - l (比赛时最小值查询写错了,好菜啊)#include<bits/stdc++.h>int p[200000
2017-07-30 09:35:27 1838
原创 CodeForces - 758D【贪心+精度】
D. Ability To Convert time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Alexander is learning how to convert numbers from the decimal system
2017-07-29 21:07:19 323
原创 A simple math problem【打表找规律】
“玲珑杯”ACM比赛 Round #19 题意: 输入n值,根据题目公式,算出10的第An项次幂; 思路: 根据这两天写题发现,打表找规律进而推公式,是一个不错的好方法,这个题的规律打表就会发现,详看代码中的枚举;#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>#include<queue>#in
2017-07-29 19:22:38 504
原创 Clarke and number 【sqrt精度+打表找规律】
基准时间限制:1 秒 空间限制:32768 KB 分值: 80 克拉克是一名人格分裂患者.某一天克拉克变成了一名数论研究者,在研究数字. 他想到了一个题:给定非负整数 x 和正整数 k ,可以做若干操作,每次操作是以下两种方法之一: 1. x=x−k 2. x=⌊x√⌋2 现在克拉克想知道,这个整数最少经过多少次操作可以变成 0 .Input 第一行是一个正整数T(1≤T≤100),
2017-07-29 10:29:21 405
原创 UVA - 10815【字符串处理STL】
题目链接Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is, well, not quite enough. Instead of thinking up all
2017-07-28 19:47:16 1452
原创 UVA - 10294【polya】
题目链接 大神题解: 分别考虑旋转和翻转的情况,并计算等价类的个数sum1,sum2: 1.旋转: 置换有n种:不旋转(转0位),转1位,…,转n-1位,若转i位,则有gcd(n,i)个等价类 证明之: (gcd:最大公约数,lcm:最小公倍数) 将珠子从0到n-1标号,对于旋转i位的置换,在以0号为起点,长度为t的一个循环节中,元素标号为:0,i%n
2017-07-28 13:55:28 305
原创 1166 Sorting LightOJ【置换群基础】
Given an array containing a permutation of 1 to n, you have to find the minimum number of swaps to sort the array in ascending order. A swap means, you can exchange any two elements of the array.For ex
2017-07-28 11:03:52 361
原创 hdu 6038 Function【置换群进阶】
FunctionTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1389 Accepted Submission(s): 644Problem Description You are given a permutation
2017-07-28 10:19:51 513
原创 poj 1026 Cipher【置换群*循环节】
Cipher Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22118 Accepted: 6114 DescriptionBob and Alice started to use a brand-new encoding scheme. Surprisingly it is not a Publi
2017-07-27 19:45:29 432
原创 hdu 6047 Maximum Sequence【思维】
Maximum SequenceTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 74 Accepted Submission(s): 34Problem DescriptionSteph is extr
2017-07-27 18:03:24 1368
原创 hdu 6040 Hints of sd0061【STL线性排序函数】
Hints of sd0061Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1595 Accepted Submission(s): 466Problem Descriptionsd0061, the legend of Beihang U...
2017-07-27 09:07:01 423
原创 poj 2369 Permutations【简单置换群*详解】
PermutationsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3205 Accepted: 1744DescriptionWe remind that the permutation of some final set is a one-to
2017-07-26 20:25:52 390
原创 LightOJ - 1341 【唯一分解定理】
It's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.Aladdin was about to enter to a magi
2017-07-26 16:06:01 2059 1
原创 hdu 2588 GCD【欧拉+gcd推导*经典】
GCDTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2312 Accepted Submission(s): 1167Problem DescriptionThe greatest common di
2017-07-26 11:45:13 414
原创 LightOJ - 1370【欧拉筛法*经典】
Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his assistant Bi-Shoe to go
2017-07-26 10:52:13 392
原创 hdu 1166 敌兵布阵【入门线段树 & 树状数组】
敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 93502 Accepted Submission(s): 39459Problem DescriptionC国的死对头A国这段时间正在进行军事演
2017-07-26 09:01:42 282
原创 Balala Power!【进制思维*经典】
贵州”创新大赛 !Balala Power!Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1531 Accepted Submission(s): 256Problem Des
2017-07-26 08:55:09 983
原创 B. Petya and Exam【字符串】
B. Petya and Examtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's hard times now. Today Petya needs to
2017-07-25 01:30:10 2760
原创 HDU - 1811 Rank of Tetris【并查集+拓扑*好题】
Rank of TetrisTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10101 Accepted Submission(s): 2885Problem Description自从Lele开发了R
2017-07-24 17:37:33 1582
原创 hdu 5246 超级赛亚ACMer【二分or模拟】
超级赛亚ACMerTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2931 Accepted Submission(s): 803Problem Description百小度是一个ACMer,也是一个超
2017-07-24 10:53:26 316
原创 hdu 1754 I Hate It【线段树入门+模板详解】
【创建线段树(初始化)】: 由于线段树是用二叉树结构储存的,而且是近乎完全二叉树的,所以在这里我使用了数组来代替链表上图中区间上面的红色数字表示了结构体数组中对应的下标。在完全二叉树中假如一个结点的序号(数组下标)为 I ,那么 (二叉树基本关系)I 的父亲为 I/2,I 的另一个兄弟为 I/2*2 或 I/2*2+1I 的两个孩子为 I*2 (
2017-07-23 18:05:12 382
原创 hdu 2066 一个人的旅行【vector优化】
一个人的旅行Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 38597 Accepted Submission(s): 13104Problem Description虽然草儿是个路痴(就是在杭电待了一
2017-07-23 12:26:24 305
原创 输入输出外挂模板
对于输入数据比较多的情况下,输入输出外挂可以节省不少时间。大神开挂过题博客这是一个多个数相加,介绍一下输入输出外挂模板;#include#include#includeusing namespace std;int Scan() //输入外挂{ int res=0,ch,flag=0; if((ch=getchar())=='-') fl
2017-07-23 08:52:36 542
原创 poj 3687 Labeling Balls【反向拓扑】
Labeling BallsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 14715 Accepted: 4314DescriptionWindy has N balls of distinct weights from 1 unit to N un
2017-07-21 18:09:42 223
原创 poj 3660 Cow Contest【floyed】
Cow ContestTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11964 Accepted: 6656DescriptionN (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are partic
2017-07-21 15:31:47 252
原创 poj 2367 Genealogical tree【简单拓扑+队列】
Genealogical treeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5727 Accepted: 3756 Special JudgeDescriptionThe system of Martians' blood relations
2017-07-21 09:38:04 243
原创 51 nod 1019 逆序数【归并排序||树状数组】
1019 逆序数基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。如2 4 3 1中,2 1,4 3,4 1,3 1是逆序,逆序数是4。给出一个整数序列,求该序列的逆序数。Input第1行:N,N为序列的长度(n <...
2017-07-20 21:01:22 449
原创 玲珑杯1144 - 数论你还会快速幂【结论+快速乘】
1144 - 数论你还会快速幂Time Limit:5s Memory Limit:256MByteSubmissions:520Solved:114DESCRIPTION今天HHHH在学数论,他看到一个很优美的式子:∑ni=1ik mod p∑i=1nik mod p一向热衷于抱队友大腿的HHHH便问队友ZZZZ怎么做
2017-07-20 16:28:05 349
原创 快速乘【模板】
快速乘:a*a=a+a+a·····+a(a个a相加),O(lgn/lg2)复杂度;如果a比较大:a=a*a%m =》 a=(a%m)*(a%m)%m 有可能m比较大,最终爆LL,快速乘能够解决;#includetypedef long long LL;LL f(LL a,LL b,LL c){ LL k=0; while(b) {
2017-07-20 16:17:41 574
原创 hdu 2647【反向拓扑+前向星】
RewardTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9199 Accepted Submission(s): 2937Problem DescriptionDandelion's uncle i
2017-07-20 15:34:45 1351
原创 Educational Codeforces Round 25 D. Suitable Replacement【二分】
D. Suitable Replacementtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two strings s and t co
2017-07-19 20:46:29 393
原创 poj 3061 Subsequence【简单尺取】
SubsequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 15330 Accepted: 6480DescriptionA sequence of N positive integers (10 < N < 100 000), each o
2017-07-19 17:05:04 220
原创 poj3111 K Best【最大化平均值】
K BestTime Limit: 8000MS Memory Limit: 65536KTotal Submissions: 10485 Accepted: 2698Case Time Limit: 2000MS Special JudgeDescriptionDemy has n jewel
2017-07-19 16:00:45 322
原创 hdu1285 【拓扑入门】
确定比赛名次Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 27111 Accepted Submission(s): 10865Problem Description有N个比赛队(1
2017-07-19 10:57:42 238
原创 nyoj喷水装置(二)【贪心】
喷水装置(二)时间限制:3000 ms | 内存限制:65535 KB难度:4描述有一块草坪,横向长w,纵向长为h,在它的橫向中心线上不同位置处装有n(n<=10000)个点状的喷水装置,每个喷水装置i喷水的效果是让以它为中心半径为Ri的圆都被润湿。请在给出的喷水装置中选择尽量少的喷水装置,把整个草坪全部润湿。输入第一行输入一个正整数N表示共有n次测
2017-07-19 09:58:25 295
原创 poj 2456【最大化最小值】
Aggressive cowsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 14728 Accepted: 7098DescriptionFarmer John has built a new long barn, with N (2 His
2017-07-18 20:43:59 310
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人