随笔分类 - ---杂题---
摘要:题目链接:hdu_5777_domino 题意: 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 const int N=1e5+7; 5 int a[N],t,n,k; 6 int main(){ 7 scanf("%d",&t); 8 w
阅读全文
摘要:D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output D. Road to Post Of
阅读全文
摘要:题目链接:hdu_5752_Sqrt Bo 题意: 给你一个数,问你最少要开多少次方才能为1 题解: 我们发现如果给的数大于232 那么肯定在5次以内是开不出来的,所以直接输出TAT,然后小于的就模拟一下,注意1和0的特判就行 1 #include <cstdio> 2 #include <cstr
阅读全文
摘要:题目链接:hdu_5761_Rower Bo 题意: 让你求一个物理问题 题解: xjb猜公式,由题目样例可得,答案为8/7,然后我们可以xjb猜出公式为v1*a/(v1*v1-v2*v2),然后特判一下a=0和v1<=v2的情况就OK 1 #include<bits/stdc++.h> 2 int
阅读全文
摘要:题目链接:hdu_5762_Teacher Bo 题意: 给你n个点,问你能否找到两对点的曼哈顿距离相等 题解: 最开始看到这题,看数据以为要向nlogn的复杂度发展,结果经验误导了自己,我们仔细观察可以发现,题目给的点的坐标范围为0~1e5,说明所有的点对的曼哈顿距离的种数不会超过2*m+1,意思
阅读全文
摘要:题目连接:hdu_5753_Permutation Bo 题意: 给你一个有n个数的数列c1~cn,h1~hn为1~n的排列,求ci[hi>hi-1 and hi>hi+1]的期望和。 题解: 这题意思就是让你先列出一个hi的排列,然后如果满足(hi>hi-1 and hi>hi+1)的值为1,那么
阅读全文
摘要:E. Connecting Universities time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output E. Connecting
阅读全文
摘要:D. As Fast As Possible time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On vacations n pup
阅读全文
摘要:题目链接:hdu_5742_It's All In The Mind 题意: 有一个部分的数列,让你找一个满足他给的三个条件的数列,使前两个数的和除这个数列的sum最大 题解: xjb贪心一下就行了。 1 #include<cstdio> 2 #include<cmath> 3 #define F(
阅读全文
摘要:题目连接:hdu_5734_Acperience 多校的题我还是贴官方题解的好,方便快捷,省事!! 1 #include<cstdio> 2 #include<cmath> 3 #define F(i,a,b) for(int i=a;i<=b;i++) 4 typedef long long ll
阅读全文
摘要:B. One Bomb time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a description o
阅读全文
摘要:题目连接:hdu_1007_Quoit Design 题意: 给你平面上的一些点,让你找出这些点的最近点对的距离 题解: 采用分治,达到O(nlognlogn)的时间复杂度就能艹过去了 1 #include<stdio.h> 2 #include<string.h> 3 #include<algor
阅读全文
摘要:运用快速排序的思想,可以达到线性时间找到一串数的第K大 1 #include<cstdio> 2 #define F(i,a,b) for(int i=a;i<=b;i++) 3 4 int a[1000],n; 5 void swap(int &a,int &b){int c=a;a=b,b=c;
阅读全文
摘要:题目连接:hdu_5720_Wool 题意: 给你N个数,然后给你一个区间,问你在这个区间内有多少数可以不与这N个数任选两个出来组成三角形 题解: 这里我还是贴官方的题解算了 考虑三角形三条边a,b,ca,b,c (a \ge b)(a≥b)的关系a - b < c, a + b > ca−b<c,
阅读全文
摘要:题目连接:hdu_5719_Arrange 题意: 给你1-n这 n个数,设一个排列的第i个数为Ai, Bi为A1到Ai的最小值,Ci为C1到Ci的最大值,问你有多少种排列方式,然后输出取模后的答案 题解: 最开始没注意每个数只能用一次,操蛋!这个条件太隐藏了,我们从1到n位开始扫,并且维护一个区间
阅读全文
摘要:题目连接:hdu_5718_Oracle 题意: 给你一串数,让你分出两个正整数,使其和最大,若不能分出来就输出"Uncertain" 题解: 当时比赛的时候还天真的去搞大数模版,被SB模版坑了100+分钟,以为8点45结束,然后最后都准备弃疗了,然后发现还有15分钟结束,然后下定决心自己写个模拟,
阅读全文
摘要:题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5648 题意:给你n,m 让你求出 for(1-n)for(1-m)gcd(i&j,i|j)的sum 题解:这题正解是枚举子集或者Claris的数位DP,不过这些我都不会,还是觉得简单粗暴的方法比较适合我
阅读全文
摘要:题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4547 题意:中文,不解释 题解:很裸的LCA,注意父目录打开子目录一次就够了,这里我才用倍增在线LCA+map过 1 #include<cstdio> 2 #include<iostream> 3 #i
阅读全文
摘要:题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5705 题意:给你一个时间和一个角度,问你下一个时针和分针形成给出的角度是什么时候 题解:我们可以将这个问题看成追及问题,考虑时针:每小时30°,每分钟1/2°,每秒1/120°,考虑分针:没分钟6°,每
阅读全文
摘要:题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5620 题意:给你一个n长的钢管,要分的尽可能多,且任意三条不能构成三角形 题解:看hint就知道用递推来解 1 #include<cstdio> 2 #define F(i,a,b) for(int i
阅读全文

浙公网安备 33010602011771号