
菜鸟之路
文章平均质量分 81
丶聂小白
这个作者很懒,什么都没留下…
展开
-
暑假小结
暑假基本没在COJ做题,保持了以前的240+,最多在POJ上看到熟悉的题目做掉以后去COJ也交一下,POJ刷到100多道。 各种原因当然还有自己懒导致每天只有下午有条件做题,有时候出远门还做不了,POJ也只有不多的部分是算法题,大部分是队里给的POJ水题目录里面的,只是对英文题更熟悉和有套路了一点。算法方面实在长进不大,只是一些简单算法如01背包,筛法求素数更熟练了一点,在家确实很没有学原创 2013-08-19 17:19:21 · 651 阅读 · 0 评论 -
HDU 2199 Can you solve this equation? 简单二分
题意简单,题目也没什么难度,注意下精度就好了#include #include #include #include #include #include #include #include using namespace std;double dis(double x){ return (8*x*x*x*x +7*x*x*x+2*x*x+3*x+6);}int main原创 2014-07-25 09:57:34 · 490 阅读 · 0 评论 -
HDU--4788 Hard Disk Drive 水
很常识的一个问题,在硬盘制造中,厂家认为的比例是1:1000,原创 2014-08-04 10:07:47 · 546 阅读 · 0 评论 -
POJ-1325 && HDU-1150 Machine Schedule 二分图匹配
#include #include #include #include #include #include #include using namespace std;int map[111][111];int n,m,k;int link[111];int visit[111];bool dfs(int k)//寻找从k出发的可增广路 { int i,j; for(i原创 2014-08-09 14:29:40 · 507 阅读 · 0 评论 -
HDU-4647 Another Graph Game 贪心
将边权拆成两半加到它所关联的两个点的点权中即可。因为当两个人分别选择不同的点时,这一权值将互相抵消。然后排序从最优开始取。#include #include #include #include #include #include #include #include #define LL long longusing namespace std;const int maxn=原创 2014-09-10 21:45:13 · 725 阅读 · 0 评论 -
HDU-5011 Game 博弈
n堆珠子,每次选一堆至少取一个,然后可以选择是否把这堆剩下的分为任意的a,b两部分,谁先取完谁赢,问先手的是否能获胜。#include #include #include #include #include #include using namespace std;int n;int main(){ int x; int ans; while(scanf("%d",&n原创 2014-09-15 16:37:43 · 826 阅读 · 0 评论 -
HDU-5053 the Sum of Cube 签到到到到~
纯签到题,A到B所有数字的立方的和。#include #include #include #include #include #define LL long longusing namespace std;LL a,b;LL sum;int main(){ int t; scanf("%d",&t); int cas=1; while(t--) { sum=0原创 2014-09-27 20:14:01 · 493 阅读 · 0 评论 -
HDU-4438 Hunters 期望 水
最近在复习概率DP求期望,顺便做一下。分成第二个人选择老虎或者狼的情况。然后s1+=q*(p)*(p)*(x+y)+q*p*(1-p)*x+q*(1-p)*p*y;//老虎 且第一个人选择老虎的期望s1+=(1-q)*x;//老虎 且第一个人选择狼的期望求一下取大的输出就好。原创 2014-10-03 22:47:49 · 7966 阅读 · 0 评论 -
HDU-1106 排序
最近在学java,用java刷刷水题,发现有道提交过却没A的水题,于是做了一下。#include #include #include #include #include using namespace std;int len;int cnt;__int64 ans[1111];char str[1111];int getnum(int k){ __int64 num原创 2016-07-12 17:38:59 · 450 阅读 · 0 评论 -
hackerrank-----Bear and Steady Gene
题意很简单,给一个最大为50w长度的字符串,字符串只由ACGT四种字符组成,求修改一段最短的连续子串使得ACGT各占整个字符串的四分之一。50w的长度很明显要用O(n^2)以下的复杂度,我的想法是O(n)的如下:字符串长度为len,单个字符的个数限制为limit=len/4需要修改的最短连续字符串要么是在最左端 要么是右端 要么是中间1、首先先从右端遍历字符串,一次把每位的字符加原创 2016-08-08 21:36:10 · 499 阅读 · 0 评论 -
网易2019实习生招聘笔试-牛牛的闹钟
水题,直接贴代码#include <iostream>#include <cstdio>#include <cstring>using namespace std;int n,x;int p,q;struct node{ int h,m;}ring[101];int main(){ cin>>n; for(i...原创 2018-03-28 15:08:37 · 504 阅读 · 0 评论 -
爱奇艺2018年实习生招聘笔试题题解-python开发
笔试总共三道编程题,在牛客网上考,难度都不高,已知的编程题题题库有四道,不过牛客网上没有公布全部的编程题,本文只写我遇到的三道。第一题,给出三个数x,y,z,两种操作,一种是任取两个数字都加1,一种是取一个数字+2,求最少多少次操作使得三个数字相等。思路:排序,看较小的两个数与最大的数的差值,1、差值均为偶数,直接 差值/2 求和;2、差值均为奇数,两个数+1(差值均-1),然后/2 求和,3、一...原创 2018-04-21 15:57:25 · 550 阅读 · 0 评论 -
网易2019届秋招内推笔试编程题题解-数据库开发岗
编程题共3道,貌似与其它岗位的小伙伴题目都不一样,本人遇到的难度较低。另外题面包含错别字以及描述不太清晰,值得吐槽。第一题 最小整数有一个32位整数n,试找一个最小整数m,使得m的每一位之积等于n,如果找不到这样的整数,输出0分析可知,整数m的所有位均为2-9的整数,对n做质因数分解变形(每次从9-2取数字做整除),能成功分解证明可以找到合适的整数,然后对分解出来的数字进行排序,从小到...原创 2018-08-12 21:16:06 · 1242 阅读 · 0 评论 -
URAL 1942 Attack at the Orbit
一艘飞船,舰载大炮可以摧毁位于雷达坐标轴整点处(两坐标均为zhengsh)原创 2014-04-25 00:59:25 · 629 阅读 · 0 评论 -
ZOJ-3681 E - Cup 2 dfs
#include #include #include #include #include #include #include #include using namespace std;mapans;int dfs(int n)//记忆化搜索 { int minv=n/2+1; if(ans.count(n)) { return ans[n]; } for(int原创 2014-04-16 14:50:31 · 604 阅读 · 0 评论 -
poj1401--Factorial
求的是N!中末尾0的个数,即包含因子10的个数。10=5*2,因子10的个数也就是因子2的个数与因子5的个数中较小的那个,N!=1*2*3...*N,其中2的个数一定不少于5的个数,所以要求的其实就是N!中5的个数。#include #include #include using namespace std;int f(int n){ int s=0,i; for原创 2013-08-17 16:40:36 · 612 阅读 · 0 评论 -
HDU 1231 (最长连续子序列)
#include #include #include #include #include #include #include #include using namespace std; #define max(a,b) a>b?a:b#define min(a,b) a<b?a:bint n;int a[10010];int main原创 2013-11-17 20:18:15 · 445 阅读 · 0 评论 -
CF———— Valera and Contest
Valera loves to participate in competitions. Especially in programming contests. Today he has participated in the contest with his team, consisting of n students (including Valera). This contest was原创 2013-11-30 01:38:38 · 904 阅读 · 0 评论 -
CF 371B - Fox Dividing Cheese
B. Fox Dividing Cheesetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTwo little greedy bears have found tw原创 2013-12-09 20:39:02 · 897 阅读 · 0 评论 -
UVA 11729 Commando War
最近开始有目的性做题,先从UVA开始吧题目很简单,不过算法经典给的做法感觉并不适合我,自己用结构体写了一发A了。思路就是先交代执行任务较长的任务,然后统计每个任务完成时间,循环一遍找最大值即可。#include #include #include #include #include #include using namespace std;struct node{ i原创 2013-12-09 19:37:03 · 548 阅读 · 0 评论 -
算法经典-勇者斗恶龙
第一遍读完以后感觉需要排序然后嵌套循环而且第一重龙头要倒着循环,第一次写出来程序报错,想了想其实没那么难,排序后第n位的龙头最理想也是由第n位的勇士砍掉,所以其实很简单,思维还是太僵化了。#include #include #include #include #include #include using namespace std;int main(){ int n,m; i原创 2013-12-09 17:33:19 · 1422 阅读 · 0 评论 -
CF 371A - K-Periodic Array
This task will exclusively concentrate only on the arrays where all elements equal 1 and/or 2.Array a is k-period if its length is divisible by k and there is such array b of length k, that a is原创 2013-12-09 20:40:27 · 843 阅读 · 0 评论 -
uva11077 Find the Permutations
Sorting is one of the most used operations in real life, where Computer Science comes into act. It is well-known that the lower bound of swap based sorting is nlog(n). It means that the best possible原创 2013-12-10 16:38:00 · 510 阅读 · 0 评论 -
二分法入门Poj 3122-Pie
好多二分题一看题目头就晕。。。挑个容易理解的下手#include #include #include #include #include const double pi=3.14159265359;const double esp=1e-6;using namespace std;int main(){ int t; int n,m; int i,j; int cou原创 2014-01-21 17:48:30 · 635 阅读 · 0 评论 -
动态规划-hdu2571
#include #include #include #include #include using namespace std;int a[21][1005];int max(int n,int m){ return n>m? n:m;}int main(){ int i,j,k,temp; int t; int n,m; cin>>t; while(t--)原创 2014-01-18 13:46:10 · 1216 阅读 · 0 评论 -
HDU 1421 动态规划
#include #include #include #include #include using namespace std;int f[2001][1001];int a[2001];int getf(int i,int j){ if(j*2>i) { return 1000000000; } if(j==0) { return 0; } return原创 2014-01-18 14:09:03 · 619 阅读 · 0 评论 -
ZOJ 3710 Friends 暴力
DescriptionAlice lives in the country where people like to make friends. The friendship is bidirectional and if any two person have no less than kfriends in common, they will become friends in sev原创 2014-03-11 20:19:04 · 595 阅读 · 0 评论