- 博客(14)
- 收藏
- 关注
原创 2018ACMICPC焦作现场赛 总结
开场签了A 过了十几分钟我想到I题的贪心 上机1Y然后三个人一起猜E的公式 猜了很长时间才猜到(不知道神仙怎么9min1Y的)E题 素数打表打少了 错了一发 2Y然后发现D是个水题几何 1YF题 我们看图翻译的是最长路 三个人想了一会最长路怎么BFS 感觉毫无思绪(雾?)后来看着过了好多队 我又去看了一下题 发现是min 求最短路于是六边形BFS 时间戳绕开m...
2018-11-27 15:58:37
612
原创 HDU - 6265 Master of Phi (积性函数)
由欧拉函数很容易想到积性函数 ans*=(qpow(p,q,N)+((p-1)*q%N)*qpow(p,q-1,N)%N)#include<stdio.h>#include<stdlib.h>#include<string.h>#include<math.h>#include<algorithm>#include&...
2018-09-24 21:00:33
348
原创 HDU 6273 Master of GCD(前缀和)
一个长度为100000的数组,开始每个数都是1,m次操作,每次将l到r的所有数*2或*3,问这些数的最大公约数是多少。去年现场用的线段树,但是很明显用前缀和更简单一点,每次a[l]++,a[r+1]--,最后做一遍前缀和对于2和3的数组,分别求出最小值即可#include<stdio.h>#include<stdlib.h>#include<st...
2018-09-24 20:12:14
381
原创 CodeForces 1051D Bicolorings (DP)
You are given a grid, consisting of 22 rows and nn columns. Each cell of this grid should be colored either black or white.Two cells are considered neighbours if they have a common border and sha...
2018-09-23 19:07:03
448
原创 HDU 1166 敌兵布阵 (分块)
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术,所...
2018-07-17 10:18:26
179
原创 GCPC2015 F Divisions (约数个数定理)
题意很简单,输入n,输出n的约数的个数。求约数个数两种方式,暴力sqrt(n)或者约数个数定理。很明显1e18的范围,暴力1e9次循环会T。那么,只能用约数个数定理,分解质因数。但是,一般是1e12的范围,预处理1e6的素数筛,或者1e14,处理1e7的素数筛。这道题怎么处理呢?可以用miller_rabbin大素数判定。先跑一个1e7的素数筛,那么跑完后我们...
2018-07-14 08:51:44
536
原创 CodeForces - 962C Make a Square (dfs)
水题 深搜即可 但要注意前导0的问题 #include<stdio.h>#include<stdlib.h>#include<string.h>#include<math.h>#include<queue>#include<map>#include<algorithm>#inclu
2018-04-11 19:50:18
1015
原创 Gym 101653T Runes (模拟)
给你一个字符串 是[number][op][number]=[number]的形式, 其中op可以为+- *数字其中有些‘?’问你能不能用0~9中的数字替代‘?’使等式成立 如果可能的话输出最小的 否则输出-1字符串中已经出现的字符不能使用 不能有前导0和-0乘法可能会爆int 所以要开long long要注意几组极端的的样例
2018-02-01 01:16:20
538
原创 HDU 6172 Array Challenge (矩阵快速幂+打表)
Problem DescriptionThere’s an array that is generated by following rule.h0=2,h1=3,h2=6,hn=4hn−1+17hn−2−12hn−3−16And let us define two arrays bnandan as below.bn=3hn+1hn+9hn+1hn−1+9h2n+27hnhn
2018-01-29 10:37:56
684
原创 FZU 2150 Fire Game (双起点BFS)
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start
2018-01-22 16:41:07
296
原创 UVA - 11624 Fire! (两次BFS)
Fire!Joe works in a maze. Unfortunately,portions of the maze have caught on fire, and the owner of the maze neglectedto create a fire escape plan. Help Joe escape the maze.Given Joe's location i
2018-01-20 11:35:57
198
原创 HDU 2612 Find a way (两次BFS)
Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home is at th
2018-01-18 17:17:41
242
原创 POJ 3126 Prime Path (BFS)
The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.— It is a matter of se
2018-01-18 15:52:20
169
原创 POJ 2251 Dungeon Master (三维BFS)
You are trapped in a 3D dungeon and need to find the quickest way out!The dungeon is composed of unit cubes which may or may not be filled with rock.It takes one minute to move one unit no
2018-01-18 10:48:48
337
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人