oj
文章平均质量分 66
_leon1999
qaq
展开
-
hrbust 1283 又见皇后 (dfs)
又见皇后 Time Limit: 3000 MS Memory Limit: 65536 K Total Submit: 132(37 users) Total Accepted: 50(29 users) Rating: Special Judge: No Description 国际象棋中,皇后能攻击同...原创 2018-09-28 11:01:40 · 160 阅读 · 0 评论 -
poj 2752 (kmp)
Seek the Name, Seek the Fame POJ - 2752#include<iostream>#include<vector>#include<cstdio>#include<cstring>#include<map>#include<cmath>#include<algorithm>原创 2018-03-08 16:55:08 · 160 阅读 · 0 评论 -
poj 3928(树状数组)
Ping pong POJ - 3928 #include<iostream>#include<vector>#include<cstdio>#include<cstring>#include<map>#include<cmath>#include<algorithm>#define LL long原创 2018-03-08 16:26:26 · 189 阅读 · 0 评论 -
poj 3264 (线段树,RMQ)
Balanced Lineup POJ - 3264 RMQ#include<iostream>#include<vector>#include<cstdio>#include<cstring>#include<map>#include<cmath>#define LL long long#define maxn...原创 2018-03-08 13:34:08 · 146 阅读 · 0 评论 -
hrbust 1022(模拟)
#include<iostream>#include<cstdio>#include <vector>#include<map>#include<string>#define Max(a,b) a>b?a:b#define LL long long#define maxn 100000using namespace ...原创 2018-02-28 11:55:52 · 312 阅读 · 0 评论 -
hdu 3336 count the string (前缀和)
http://acm.hdu.edu.cn/showproblem.php?pid=3336#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>#include <map>#include...原创 2018-02-17 13:16:42 · 155 阅读 · 0 评论 -
高精度计算
A.小慧的零花钱(高精度计算)Time Limit: 1000 MSMemory Limit: 32768 KTotal Submit: 72(20 users)Total Accepted: 16(16 users)Special Judge: NoDescription小羽每年都会给小慧一些零花钱,小慧特别喜欢玩具,就会攒钱买玩具,但是小羽给他的钱不够花(玩具那么贵肯定买不起啊)。有一天,小慧...原创 2018-02-17 11:58:51 · 104 阅读 · 0 评论 -
拓扑排序 (判断有向图是否存在回环)
Legal or NotTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9777 Accepted Submission(s): 4541Problem DescriptionACM-DIY is a large QQ group w...原创 2018-02-16 17:59:04 · 871 阅读 · 0 评论 -
poj 3368(ST)
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#define lowbit(x) x&-x#define LL long long#define Max(a,b) a>b?a:b#def...原创 2018-03-07 16:11:33 · 162 阅读 · 0 评论 -
poj 2236 Wireless Network(基础并查集)
Time Limit: 10000MS Memory Limit: 65536KTotal Submissions: 33151 Accepted: 13790DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless ne...原创 2018-02-10 14:59:53 · 118 阅读 · 0 评论 -
hdu 1754(线段树单节点更新)
I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 87728 Accepted Submission(s): 33538Problem Description很多学校流行一种比较的习惯。原创 2018-01-20 15:12:58 · 118 阅读 · 0 评论 -
hdu 1166(线段树入门区间求和)
敌兵布阵Time Limit: 1000 MS Memory Limit: 32768 KB64-bit integer IO format: %I64d , %I64u Java class name: Main[Submit] [Status] [Discuss]DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子De原创 2018-01-20 13:47:04 · 136 阅读 · 0 评论 -
poj 2299 (树状数组,归并排序+读入优化)
因数据量大,读入优化大概能快100多毫秒。Ultra-QuickSortTime Limit: 7000 MS Memory Limit: 65536 KB64-bit integer IO format: %I64d , %I64u Java class name: Main[Submit] [Status] [Discuss]Descri原创 2018-01-18 22:28:50 · 99 阅读 · 0 评论 -
hdu 6023
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>#include <map>#include <string>#include <queue>#define原创 2018-02-21 16:07:37 · 268 阅读 · 0 评论 -
ZOJ 2112 Dynamic Rankings(树状数组+主席树)
Dynamic RankingsTime Limit: 10 Seconds Memory Limit: 32768 KBThe Company Dynamic Rankings has developed a new kind of computer that is no longer satisfied with the query like to simply find t...原创 2018-09-11 21:21:54 · 165 阅读 · 0 评论 -
hrbust 1522 子序列的和(RMQ)
子序列的和Time Limit: 1000 MSMemory Limit: 32768 KTotal Submit: 541(111 users)Total Accepted: 121(75 users)Rating: Special Judge: NoDescription输入一个长度为n的整数序列(A1,A2,……,An),从中找出一段连续的长度不超过m的子序列,使得这个子序列的和最大。Inp...原创 2018-07-05 15:51:32 · 209 阅读 · 0 评论 -
hdu 2665 Kth number (主席树)
Kth number HDU - 2665 主席树的空间复杂度约为2*nlog(n)#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;#define N 100000int a[N],b[N];int L[N...原创 2018-07-01 12:28:00 · 159 阅读 · 0 评论 -
hrbust 1039(二分)
修路Time Limit: 1000 MS Memory Limit: 65536 KB64-bit integer IO format: %lld , %llu Java class name: Main[Submit] [Status] [Discuss]Description前段时间,某省发生干旱,B山区的居民缺乏生活用水,现在需要从A城市修一条通往B山区的路。假设有A城市通往B山区的路由m...原创 2018-03-30 12:06:06 · 127 阅读 · 0 评论 -
中国石油大学月赛 回文数
问题 G: 回文数时间限制: 1 Sec 内存限制: 256 MB提交: 178 解决: 54[提交][状态][讨论版]题目描述若一个数(首位不为零)从左向右读与从右向左读都一样,我们就将其称之为回文数。例如:给定一个10进制数56,将56加65(即把56从右向左读),得到121是一个回文数。又如:对于10进制数87:STEP1:87+78 = 165 STEP2:165+561 = 726S...原创 2018-03-14 14:02:08 · 119 阅读 · 0 评论 -
poj 2299(树状数组,逆序对)
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#define lowbit(x) x&-x#define LL long long#define maxn 500005using namespace std;struct node{...原创 2018-03-06 17:11:24 · 269 阅读 · 0 评论 -
poj 3461 (kmp)
OulipoTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 45343 Accepted: 18135DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. H...原创 2018-02-24 23:15:50 · 156 阅读 · 0 评论 -
poj 2155(二维树状数组,区间更新,单点查询)
Matrix POJ - 2155 二维树状数组和一维的树状数组类似:就是多了一层循环例如要更新一个某个点的值void add(int x,int y,int k){ for(int i=x;i<=n;i+=lowb(i)) { for(int j=y;j<=n;j+=lowb(j)) { F[i][j]+=k;...原创 2018-03-09 20:57:42 · 163 阅读 · 0 评论 -
单词接龙(dfs)
练了一下string的一些操作string真的非常实用,就是有一点耗时。#include<bits/stdc++.h>#define LL long long#include<string>#define Max(a,b) a>b?a:busing namespace std;string a[25];int vis[25];int maxn=0;in...原创 2018-03-15 19:30:46 · 1408 阅读 · 2 评论 -
csu 1021 (组合数末尾的0)
从m个不同元素中取出n (n ≤ m)个元素的所有组合的个数,叫做从m个不同元素中取出n个元素的组合数。组合数的计算公式如下:C(m, n) = m!/((m - n)!n!) 现在请问,如果将组合数C(m, n)写成二进制数,请问转这个二进制数末尾有多少个零。Input第一行是测试样例的个数T,接下来是T个测试样例,每个测试样例占一行,有两个数,依次是m和n,其中n ≤ m ≤ 1000。Out...原创 2018-03-09 10:35:57 · 145 阅读 · 0 评论 -
基数为负数的进制转换
#include<iostream>#include<cstdio>#define LL long long#define maxn 100#define Max(a,b) a>b?a:busing namespace std;char str[20]={'0','1','2','3','4','5','6','7','8','9','10'};char...原创 2018-03-15 12:56:55 · 728 阅读 · 0 评论 -
hdu 1045 Fire Net(递归解法和非递归解法)
A - Fire Net HDU - 1045 #include#include#include#include#include#include#define LL long longusing namespace std;char ss[5][5];char mp[5][5];int vis[5][5];int main(){ int n;原创 2018-01-18 15:28:45 · 159 阅读 · 0 评论 -
CodeForces - 651C(map,make_pair)
Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (x转载 2018-01-31 16:08:48 · 235 阅读 · 0 评论 -
poj 3061(连续子序列问题)
SubsequenceTime Limit: 1000 MS Memory Limit: 65536 KB64-bit integer IO format: %I64d , %I64u Java class name: Main[Submit] [Status] [Discuss]DescriptionA sequence of N positive原创 2017-12-14 08:44:32 · 234 阅读 · 0 评论 -
hrbust I Want Candy 2353
I Want CandyTime Limit: 1000 MSMemory Limit: 256000 KTotal Submit: 25(8 users)Total Accepted: 8(6 users)Rating: Special Judge: NoDescription原创 2017-12-21 10:43:52 · 146 阅读 · 0 评论 -
NEUQ oj 1861: 聪会长的关爱
1861: 聪会长的关爱描述题目描述:大家都知道NEUQ-ACM俱乐部的会长聪聪是个英俊帅气的暖男,他最喜欢关心各路好看的妹子了。 这一天,他来到工学馆的一间教室,发现好多好多的漂亮小姐姐。但是小姐姐们都被一些丑陋的男人围着,聪聪很害怕,他不想得罪他们。 所以聪聪决定从一个小姐姐开始,把所有和她相邻的小姐姐,以及相邻的相邻的小姐姐(相邻小姐姐是指原创 2017-12-03 22:55:27 · 379 阅读 · 0 评论 -
HRBUST 2337
#include#include#include#include#include#includeusing namespace std;struct node{ long num; int step; int yustep; int ci;};queueq;long vis[30005];int main(){ int n; l原创 2017-11-22 16:47:12 · 289 阅读 · 0 评论 -
Hrbust 菜鸟和大牛(递归做法)
#include#include#include#includeusing namespace std;int a[105][220];int vis[105][220];int n;int dfs(int i,int j){ if(vis[i][j]!=0) { return vis[i][j]; } if(i==n) {原创 2017-12-01 18:13:30 · 283 阅读 · 0 评论 -
简单链表
#include#includeusing namespace std;int n;struct node{ long num; char name[30]; int age; node *next;};node *creat(int n){ node *head,*pnew,*pend; pnew=new node; sc原创 2017-12-01 15:59:48 · 136 阅读 · 1 评论 -
约数个数定理
约数个数定理编辑对于一个大于1正整数n可以分解质因数: 则n的正约数的个数就是 。其中a1、a2、a3…ak是p1、p2、p3,…pk的指数。定理简证编辑首先同上,n可以分解质因数:n=p1^a1×p2^a2×p3^a3*…*pk^ak,由约数定义可知p1^a1的约数有:p1^0, p1^1, p1^2.....原创 2017-12-09 16:22:32 · 2108 阅读 · 0 评论 -
poj 3984 迷宫问题
迷宫问题Time Limit: 1000 MS Memory Limit: 65536 KB64-bit integer IO format: %I64d , %I64u Java class name: Main[Submit] [Status] [Discuss]Description定义一个二维数组: int maze[5][5] =原创 2017-12-06 17:27:14 · 278 阅读 · 0 评论 -
广东工业大学月赛1256
Problem E: 单身狗Time Limit: 1 Sec Memory Limit: 128 MBDescription给定N,统计[1,N]中所有数字1出现的次数。Input第一行为一个整数T,表示测试用例的数量。每个测试用例包含一个数字N。数据范围:T<=100,1<=N<=1e9。Output对于每组测试用例,输出[1,N]中所有数字1出现的次数。Sample In...原创 2018-04-06 20:32:16 · 113 阅读 · 0 评论 -
八皇后(dfs)
题目描述检查一个如下的6 x 6的跳棋棋盘,有六个棋子被放置在棋盘上,使得每行、每列有且只有一个,每条对角线(包括两条主对角线的所有平行线)上至多有一个棋子。上面的布局可以用序列2 4 6 1 3 5来描述,第i个数字表示在第i行的相应位置有一个棋子,如下:行号 1 2 3 4 5 6列号 2 4 6 1 3 5这只是跳棋放置的一个解。请编一个程序找原创 2017-12-22 13:17:09 · 258 阅读 · 0 评论 -
hpu练习赛美素数(素数筛+dp)
G - 美素数 #include#include#include#include#include#includeusing namespace std;#define MAXN 1000001long su[MAXN];long prime[MAXN];int vis[MAXN];int st[MAXN];void issushu(){ me原创 2018-01-21 22:51:13 · 187 阅读 · 0 评论 -
hdu1003(动态规划,最大子序列和)
Max SumTime Limit:1000 MSMemory Limit:32768 KB64-bit integer IO format:%I64d , %I64uJava class name:Main[Submit] [Status] [Discuss]DescriptionGiven a sequence a[1],a[2],a[3]......a[n],...原创 2018-01-22 22:05:42 · 4228 阅读 · 5 评论 -
hrbust 1401 九连环
最近学了矩阵快速幂,于是趁热打铁刷了一波题。。。要加油了!九连环Time Limit: 1000 MSMemory Limit: 65536 KTotal Submit: 69(40 users)Total Accepted: 36(33 users)Rating: Special Judge: N原创 2017-12-19 16:20:18 · 217 阅读 · 0 评论