自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

明日菜心

keep learning

  • 博客(45)
  • 问答 (1)
  • 收藏
  • 关注

原创 社区发现算法

社区发现算法一.原始LPA算法引用 https://greatpowerlaw.wordpress.com/2013/02/08/community-detection-lpa/算法原理 标签传播算法是不重叠社区发现的经典算法,其基本思想是:将一个节点的邻居节点的标签中数量最多的标签作为该节点自身的标签。给每个节点添加标签(label)以代表它所属的社区,并通过标签的“传播”形成同一标签的

2017-07-03 01:52:48 6956

原创 谈谈Spark GraphX吧!

一.浅谈Spark GraphX1.首先,介绍下构成图的两大结构体。1)一个是节点RDD,其结构体如下:VertexRDD[VertexProperty]=RDD[(VertexId,VertexProperty)]2)一个是边RDD,其结构体如下:EdgeRDD[EdgeProperty]=RDD[Edge[EdgeProperty]]),附加一个既含有节

2017-06-29 21:00:51 4356

原创 ACM注意事项(水鸟的纪念)

1).输入冲突int a,b;scanf("%d%d\n",&a,&b);输入时,可能存在这样的问题: 输入两个数后,光标还在闪,等待输入。这时,一定要记住删除“\n”。2).命名冲突变量与数组名不要取一样,否则很容易出错误。3).强制类型转换double p;int a,b;p=(double)a/b; 注意:错误写法:p=(dou

2016-12-06 21:40:16 432

原创 Isolation forest的python代码实现

近期一直在看Isolation forest,顺便也看了random forest,k-d tree,有关Isolation forest的资料很少,Isolation forest在异常检测方面效果不错,从其算法思想上看主要结合了random forest和k-d tree算法思想Isolation forest算法思想如下:建立多个tree(理论上最好的效果tree的个数为100)

2015-08-26 15:48:58 10413 5

原创 爬虫的关键技术(以电影数据的爬取为例)

源代码见项目crawler。dao层:主要和数据库进行交涉,本包主要是向数据库中添加电影信息,评分信息以及从数据库中读出电影信息;model层:主要把对象封装起来,本包主要把电影信息和评分信息作为两个对象,将其属性封装起来;util层:常用的操作放在一个包里,本包主要创建与数据库的连接,URL的获取和数据格式的定义;search层:项目的核心业务层,主要分析如何从网页中爬取

2014-12-24 11:16:36 4435 2

原创 分支-02. 三角形判断(15)

题目来源:http://pat.zju.edu.cn/contests/basic-programming/%E5%88%86%E6%94%AF-02注:只想说,我去,

2014-07-18 21:51:33 957

原创 1001. A+B Format (20)

题目来源:http://pat.zju.edu.cn/contests/pat-a-practise/1001

2014-07-16 21:31:42 434

原创 数组排序

import java.lang.System;import java.util.Scanner;public class InsertSort {double a[];Scanner s;public InsertSort(){ a=new double[11]; s=new Scanner(System.in); int i; a[0]=0;//起哨兵的作用 Syst

2014-07-14 22:30:23 385

原创 窗口形式的九九乘法表

import java.lang.System;import javax.swing.*;public class MultiplyList {public static void main(String args[]){String uu="";int col,row;for(row=1;row<=9;row++) {for(col=1;col<=row;col++) uu+

2014-07-14 21:41:57 843

原创 鸽巢原理的模拟

import javax.swing.*;import java.lang.Math;public class PigeonNest { int nest[]; public PigeonNest(){ nest=new int[7]; int i; for(i=0;i<nest.length;i++) nest[i]=(int)(1000*Math.random()%6+

2014-07-14 21:22:38 599

原创 评判多个学生成绩等级

import javax.swing.*;import java.lang.System;import java.util.Scanner;import java.util.Comparator;public class grade implements Comparator{ Scanner s; public grade(){ s=new Scanner(System.in

2014-07-13 16:48:34 549

原创 1006. 换个格式输出整数 (15)

题目来源:http://pat.zju.edu.cn/contests/pat-b-practise/1006#include#includeint main(){int n;while(scanf("%d",&n)!=EOF){int nb=0,ns=0,ng=0;nb=n/100;ns=(n-nb*100)/10;ng=n-nb*100-ns*10;if(n

2014-03-18 13:28:26 561

原创 1004. 成绩排名 (20)

题目来源:http://pat.zju.edu.cn/contests/pat-b-practise/1004教训:别傻帽似的认为题目要求字符串个数不超过10,就呆呆的把数组开为10.。多开点,也没叫你要钱。。主要是你输入一串字符串,结尾还有个回车呢。。所以以后,数组尽量开大点。#include#includetypedef struct{char name[15];ch

2014-03-18 12:44:24 792

原创 1003. 我要通过!(20)

题目来源:http://pat.zju.edu.cn/contests/pat-b-practise/1003注意:此题20分,我只得了17分,应该程序还存在我看不到的问题,如果哪位大神看见了,麻烦指点一下。#include#includeint main(){int n;scanf("%d",&n);for(int i=0;i<n;i++){char a[100]={0

2014-03-16 23:24:40 493

原创 1002. 写出这个数 (20)

题目来源:http://pat.zju.edu.cn/contests/pat-b-practise/1002#includeint main(){char n[100]={0};int k=0;scanf("%s",n);char *ll;ll=n;while(*ll!='\0'){k=k+(*ll)-'0';ll++;}char *kk[]={"ling","

2014-03-16 22:18:56 504

原创 1001. 害死人不偿命的(3n+1)猜想 (15)

题目来源:http://pat.zju.edu.cn/contests/pat-b-practise/1001留作个纪念。#includeint main(){int n;scanf("%d",&n);int num=0;while(n!=1){if(n%2==0)n=n/2;else n=(3*n+1)/2;num++;}printf("%d",num);

2014-03-16 22:16:46 464

原创 消除文法的左递归

#include#includetypedef struct{char right[20];//产生式右部}Right;typedef struct{char left; //产生式的左部Right r[100];int flag;//标志位,判断该产生式是否存在左递归,0表示无左递归,1表示直接左递归,2表示间接左递归int num;//右部的产生式

2013-06-08 12:04:33 1149

原创 Chomsky文法类型判断

#include#includetypedef struct{char left[10]; //产生式的左部char right[10]; //产生式的右部}regular;regular re[100];int main(){printf("******Chomsky文法类型判断*******(以0为产生式输入的结束符)\n");while(1

2013-06-02 15:59:48 1677 5

转载 1005—Graduate Admission

题目来源:http://ac.jobdu.com/problem.php?pid=1005 代码:#include #include #include #include using namespace std;const int N = 44444;const int M = 111;struct Stu { int ge, gi, i

2013-05-22 23:35:25 471

原创 1597—find the nth digit

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1597收获:挺简单的~~我是先根据求和公式算出该数是位于哪一行(Sn)~~然后求前一行的数字个数之和sum,再用该数减去sum,求出位于第n行的哪个位置~~对于每一行,是九个数循环一次,对于9或9的倍数对9求余,为0,;其他的数,对9求余即为相应的数~~S1 1 S2 1 2

2013-05-11 20:58:29 458

原创 1061—Rightmost Digit

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1061收获:1.利用二进制求指数幂(快速幂法)~~减少循环次数和提高速度(适用于乘数比较大的情况下)2.(a*b)%n=(a%n*b%n)%n; #include#include#include#includeint main(){int t;__in

2013-05-05 23:16:10 550

原创 1060—Leftmost Digit

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1060收获:计算N^N结果的最左边的数由sum=N^N,两边对10取对数,log10(sum)=Nlog10(N),有sum=10^(Nlog10(N));sum=10^(整数+小数)=10^整数*10^小数;由于10的整数次幂首位均为1,则仅需考虑Nlog10(N)的结果的小数部分,取

2013-05-05 21:29:19 469

原创 1004—Median

题目来源:http://ac.jobdu.com/problem.php?pid=1004收获:在函数内的变量是局部变量,占用栈空间;函数外的变量时全局变量,占用堆空间; 栈空间可以简单的理解为近似整个内存,效率低,大小近似内存大小堆空间可以简单的理解为内存中一小块专用地方,效率高,大小有限我的代码:#include#include#include#incl

2013-04-27 09:49:09 431

原创 1020—Encoding

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1020收获:把数字以字符的形式输出:int k;char t[3];t[1]=k+'0'【这里的数字字符转换,限定数字的范围为0~9】,也就是这个地方错了。我的代码:#include#include#include#includeint main(){char

2013-04-20 22:32:42 500

原创 1019—Least Common Multiple

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1019收获:最小公倍数两个数的乘积=最小公倍数*最大公约数。原理:d为a,b的最大公约数,a/d=c,b/d=e;(c、e互质)a*b/d=a*e=c*b;(a*b/d是a,b的最小公倍数数)最小公倍数*最大公约数=a*b/d*d=a*b=两个数的乘积; 我的代码:#in

2013-04-20 20:36:23 533

原创 1002—Grading

题目来源:http://ac.jobdu.com/problem.php?pid=1002看懂题意~~我的代码: #include#include#include#includeint max(int a,int b,int c){int m;m=a;if(b>m)m=b;else if(c>m)m=c;return m;}int m

2013-04-20 19:45:24 570

原创 1010—A+B变种(~~2)

题目来源:http://ac.jobdu.com/problem.php?pid=1010收获:比较两个字符串,切记字符串的长度一定要一样长,本题,我比较k[5][10]与pp[][10],原本我把k的列设为100,即k[5][100],但是和pp[][10]比较时,明明'one'与'one'相等,却总不行(我采用单步跟踪的方法)~~如果想要求两字符串相等,不但要求比较的串长度相等,还有后面没

2013-04-20 18:59:59 498

原创 1001—A+B for Matrices

题目来源:http://ac.jobdu.com/problem.php?pid=1001收获:原本题目没读懂~~英语不行~~题意:先输入行和列的数 再列出2*(行数)的数字(自己打出的数字) 然后把行数分一半 前一半和后一半相加 算出行数都是零和列数都是零的总和我的代码:#include#include#includeint main(){int n,

2013-04-20 10:45:51 365

原创 1014—Uniform Generator

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1014收获:1.线性同余方法(LCG)是个产生伪随机数的方法。它是根据递归公式:其中是产生器设定的常数。LCG的周期最大为,但大部分情况都会少于M。要令LCG达到最大周期,应符合以下条件:互质;的所有质因数的积能整除;若是4的倍数,也是;都比小;是正整数。线性同余法产

2013-04-20 00:04:42 438

原创 1003—A+B变种(~~)

题目来源:http://ac.jobdu.com/problem.php?pid=1003收获:题目不难~~,注意如果题目要求输入多组数据,又没要求几组,通常是以EOF为结束。Output limit exceed意味着输出超出限制,恐怕是没有结束符的缘故吧~~ 我的代码: #include#include#includeint main(){cha

2013-04-19 22:49:35 492

原创 1013—Digital Roots

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1013 收获:一个数的各个位数之和除以9的余数等于这个数除以9的余数。原因:从各个数位来分析:个位上的数的大小没有发生变化;十位数将10看成了1、看少了1个9,20看成了2、看少了2个9,…;百位上将100看成了1、看少了11个9,200看成了2、看少了22个9,…;……这些少看的若干个9除

2013-04-18 16:43:28 383

原创 1071—The area

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1071经验教训:纯数学题~~~我的代码(抛物线作于原点会更好做点~~)#include#include#includeint main(){int t;double x1,x2,x3,y1,y2,y3;scanf("%d",&t);int i;fo

2013-04-17 23:48:57 410

原创 1005—Number Sequence

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1005经验教训:其实,这题我不会做,规律没找出来,只是把看懂了而已。。。我的代码:#include#include#include //至于最大周期49,原因是://由于mod7(取余数),所以每两相邻数最多只有7*7=49种可能,在此基础上的第三个数由前两个数决定。

2013-04-17 20:45:41 454

原创 1009—FatMouse' Trade

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1009  经验教训:在discuss看到别人的测试数据,一个个测,才知道自己错在哪了~~m==0和n==0一开始没考虑到~~按效益降低的排序~~不难~~注意点就行了。。别人的测试数据:此题除了要满足例子以外,还要满足一些条件才能真正算ac:0 11 01.0001 00.

2013-04-14 22:54:23 500

原创 1003—Max Sum

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1003 经验教训:动态规划还没看到~~先弱个题,理解一下意思~~代码真丑。。。 我的代码:#include#include#include int main(){int t;scanf("%d",&t);int i,k=0,start,end,kk;

2013-04-14 20:53:00 377

原创 1008—Elevator

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1008经验教训:理解题目很重要我的代码: #include#include#include int main(){int a[104],n;while(scanf("%d",&n)&&n!=0){int i,ww;ww=0;for(i=1;i<=n;

2013-04-07 21:18:32 456

原创 1004—Let the Balloon Rise

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1004经验教训:这是道很水的题目,错因在于没考虑n=1的情况,所以,测试时应该多选一下边界值;有时也有可能是数组越界。。  我的代码:#include#include#includetypedef struct { char str[16]; }I

2013-04-07 20:40:31 437

原创 1048—The Hardest Problem Ever

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1048 经验:卡在这题,主要是运行过程发生错误,其实还是挺简单的,数组设置的太少了。嗯,以后若出现runtime,就要检查数组是否越界以及是否使用了野指针,总之,和内存溢出很有关系。 我的代码: #include#includeint main(){char bu

2013-04-04 23:06:10 439

原创 成绩评估

题目来源:http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=168 太过于纠结了。。太太笨了。。。呜呜。。哭死收获:105/10还是10,输出的结果是A,其实应该输出("Score is error!")。。。笨死了。。吸取教训。#includeint main(){int t;while(scanf("%d",&t)!=EOF)

2013-03-21 22:16:38 883

原创 说反话

原题目出处:http://icpc.ahu.edu.cn/OJ/ContestProblem.aspx?cid=24&id=499#include#includeint main(){int n;scanf("%d",&n);getchar();int i;char k[1002],uu[1002];for(i=0;i<n;i++){gets(k);

2013-03-21 21:25:46 572

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除