- 博客(39)
- 资源 (1)
- 收藏
- 关注
原创 SparkStreaming找不到reduceByKey的解决方法
别人的在这里http://www.68idc.cn/help/jiabenmake/qita/20150115172034.html我也遇到同样的问题,我是spark1.0.2,也可能和版本有关,因为我1.3.0的时候不出错。根据别人的分析,问题应该是隐式转换Scala会将DStream隐式转换成PairDStreamFunctions,该类中有K/V数据类型相
2015-08-17 17:59:25 609
原创 scala的下划线用法
几个用处:1、作为“通配符”,类似Java中的*。如import scala.math._2、:_*作为一个整体,告诉编译器你希望将某个参数当作参数序列处理!例如val s = sum(1 to 5:_*)就是将1 to 5当作参数序列处理。3、指代一个集合中的每个元素。例如我们要在一个Array a中筛出偶数,并乘以2,可以用以下办法:a.filter(_%2==
2015-06-23 11:05:05 475
原创 1037 Magic Coupon (25)
#include#include#includeusing namespace std;class CA{public: void run();private: int nc,np,max; vector cou; vector couf; vector pro; vector prof;};void CA::run(){ cin
2014-02-28 16:47:29 572
原创 1020 Tree Traversals (25)
#include #include #include #include #include using namespace std;class A{public: struct node { int no; node *lchild; node *rchild; }; void init(); void run(); voi
2014-02-28 15:19:33 448
原创 1019 General Palindromic Number (20)
#include using namespace std;class A{public:enum{N=100};void init();void run();bool ispalindromic();int digit,base;int ar[N],n;};bool A::ispalindromic(){int i,j;i=0;j=n-1
2014-02-28 15:18:40 423
原创 可以参考这几个人的博客
http://blog.csdn.net/sunbaigui/article/category/1361816http://blog.csdn.net/lv_zj/article/category/1740669 lv_zj
2014-02-27 21:18:56 498
原创 1036 Boys vs Girls (25)
这个题太简单 #include#include#include#include#includeusing namespace std;class CA{public: void run();private: int n; struct stu { string name; char gender; string id;
2014-02-27 16:19:37 457
原创 1035. Password (20)
这里注意,函数的参数string类型 &号表示,里面的值会改变!!!#include#include#include#includeusing namespace std;class CA{public: enum{N=1001}; void run(); bool change(string &st);private: int n,m,coun
2014-02-27 15:35:56 528
转载 1034. Head of a Gang (30) (我自己写的程序前后可能出现不合并的情况,参考程序好,简单实用)
http://blog.csdn.net/lv_zj/article/details/16115641#include #include #include #include using namespace std;class CA{public:void run();void addmap(string &s1,strin
2014-02-27 14:54:38 505
转载 1033 . To Fill or Not to Fill (25) (想明白了没写出来,参考吧)
http://blog.csdn.net/lv_zj/article/details/16115569 #include #include #include using namespace std;class CA{public: class cstation { public: int point,addlen; double price;
2014-02-26 22:12:23 664
转载 1032 1032. Sharing (25)(自己写的超时了,参考的方法好。用标记来看是否已经检查过这个点)
#include #include using namespace std;class CA{public: enum{N=100000}; void run(); int ar[N],addr1,addr2,n; bool b[N];};void CA::run(){ n=N; fill_n(ar,n,-1); fill_n(b,n,f
2014-02-26 15:35:58 897
原创 1031 . Hello World for U (20)
#include#include#include#include using namespace std;class CA{public: enum{N=30}; void run();private: char st[100]; int n;};void CA::run(){ cin>>st; int i,j,k,n1,n2;
2014-02-26 14:10:59 423
原创 1030 Travel Plan (30)
#include#include#include#includeusing namespace std;class CA{public:enum{N=500,INF=0x7FFFFFFF/2};//void init();void run();void getshortestlen();void minimumcost(int c1,int
2014-02-26 13:24:30 572
转载 1029 Median (25)
自己做的运行超时参考http://blog.csdn.net/sunbaigui/article/details/8657126#include#includeint main(){int n1, n2;while(scanf("%d",&n1)!=EOF){std::vector a, b;for(int i = 0; i {
2014-02-25 21:26:42 471
转载 1028 List Sorting (25)(友元函数的使用)
自己写的用超时。以下为他人做的,不超时http://blog.csdn.net/lv_zj/article/details/16114247#include #include #include class cstudent{public: int id; char name[10]; int score; friend bool IdCmp(cons
2014-02-25 19:21:44 480
原创 1027 Colors in Mars (20)
#include#include#includeusing namespace std;class CA{public:void run();char earthtomars(int a);private:int a[3];char b[7];};void CA::run(){cin>>a[0]>>a[1]>>a[2];
2014-02-25 19:17:57 490
转载 1026 Table Tennis (30)完全不会
#include #include #include #include #include #include using namespace std;class ctable{public:enum{opentime=8*3600,closetime=21*3600};int curtime;int vip;int servernum;ctab
2014-02-25 19:16:50 706
原创 1025 PAT Ranking (25)
这里第一次自己尝试了map,以及iterator,这里主要最后的imp输出要用cout不能用printf,不知为何。string类型可以直接>或#include#include#include#include#include#includeusing namespace std;class CA{public: enum{N=102,K=302};
2014-02-24 21:12:22 456
原创 1024 Palindromic Number (25)(i取到0,也取到s.size()-1,vector的时候i也是取到size()-1)
#include#include#include#includeusing namespace std;class CA{public: void run(); bool palindromic();private: vector zheng,fan,ans; int k;};void CA::run(){ string st;
2014-02-24 16:59:31 522
原创 1023 Have Fun with Numbers (20)(vector<int> di,di读取string里的数字)
#include#include#include#include#includeusing namespace std;class CA{public: enum{N=21}; void run();private: vector di,di2,diout;};void CA::run(){ string s; getline(c
2014-02-24 15:37:59 569
原创 1022. Digital Library (30) (gets,getline,priority_queue,map,参考程序)
只有25分#include#include#include#includeusing namespace std;class CA{public:enum{M=1000};void init();void run();private:int n,m,ans[10000];struct book{int id;char ti
2014-02-24 13:53:16 408
转载 1021. Deepest Root (25) (查询最小路径,查询有多少部分圈,学习iterator)
这里学会使用vector::iterator it的使用#include #include #include #include using namespace std;class A{public:enum{N=10001};void init();void run();int gettreelevel(int c,int f
2014-02-24 01:32:11 406
转载 1018
#include #include #include #include #include using namespace std;class A{public: enum{N=501,INF=0x7FFFFFFF/2}; void init(); void run(); void dijkstra(); void findbestpath(int
2014-02-23 13:08:07 379
原创 1018 . Public Bike Management (30)自己写的,只有14分
#include#includeusing namespace std;class CA{public: enum{C=100,N=501,INF=0x6FFFFFFF}; void run(); void shortest(); void dowell(int v);private: int c,n,dp,m; int bikes[N];
2014-02-23 13:07:33 413
转载 1017. Queueing at Bank (25) (priority_queue,然后用到了运算符重载)
这个题目用到了priority_queue,然后用到了运算符重载#include#include#includeusing namespace std;struct window { int mm; int hh; int ss; bool operator { if(hh>a.hh)
2014-02-22 21:30:48 442
转载 1016 重要Phone Bills (25)
#include #include #include #include #include #include #include using namespace std;struct billnode { string name; int mouth,date,hour,mini,total; string status; bool operator
2014-02-22 19:52:00 500
转载 1015 reversible primes
转。。。不太难,没理解一开始#include #include class A{public: void run();private: bool isprime(int num); int reverse(int num,int radix);}; void A::run(){ int n,d,rn; while(true) {
2014-02-22 15:59:17 400
原创 1014 Waiting in Line (30)
只拿了19分不知为何。#includeusing namespace std;class A{public: enum{N=20,M=10,K=1000,max_time=540}; int findmin(); void init(); void run(); void printanswer();private: int n,m,k,q; i
2014-02-22 15:11:00 446
转载 1013 这个题中用到stack<int> st 需要学习
这里标记下是否还有没访问过的点,如果有,则说明需要+1条路#include #include #include using namespace std;class A{public: enum{N=1010}; void init(); void run();private: int checklinkmap(int ic); int n,m,k
2014-02-21 22:12:12 658
原创 1012 The Best Rank (25)
#include#includeusing namespace std;class CA{public: enum{MAX=2000}; void run(); void findbest(char ID[7]); void findrank(int a[4]); void sort();private: int n,m; int rank;
2014-02-21 18:22:10 374
原创 1011. World Cup Betting (20)
#includeusing namespace std;class CA{public:void run();void jieguo(float *win,float *tie,float *loss);private:float win[3];float tie[3];float loss[3];float chos[3];float pr
2014-02-21 15:20:36 393
原创 1010 Radix (25)
这个题目本身也有问题,digit才最大36,radix居然可以达到sum+1、、、、 #include#include#include#include using namespace std;class CA{public: enum{N=11}; void run();private: struct element { char i
2014-02-17 00:50:15 557
原创 1009 Product of Polynomials (25)
#includeusing namespace std;class CA{public: enum{N=100}; void init(); void run();private: struct poly { int k; int exp[N]; float cos[N]; }; poly *a,*b,*c; };void
2014-02-16 19:31:54 496
原创 1008 Elevator (20)
#includeusing namespace std;class CA{public: enum{LIMIT=100}; void run(); void caltime();private: int n; int floor[LIMIT]; int time;};void CA::run(){ cin>>n; int i; f
2014-02-16 15:55:58 394
原创 1007 Maximum Subsequence Sum
当然,数据结构与算法分析的书上还有分治的方法,这种方法比较简单。第二章。 #include#includeusing namespace std;void MaxSubsequenceSum(const int A[],int N){ int thissum,maxsum,j,start,finish,mark; thissum=0; maxsum=-1;
2014-02-16 15:16:48 393
原创 1006 Sign In and Sign Out (25)
#include#include#includeusing namespace std;class CA{public: enum{N=16,TIME=9}; void run();private: struct member { char idname[N]; char intime[TIME]; char outtime[TIM
2014-02-16 14:23:59 450
原创 1005 Spell It Right (20)
#include#includeusing namespace std;class CA{public: enum{N=100}; void run(); void calcusum(); void translate(int number); void print(int number);private: char num[N]; int
2014-02-16 13:16:33 387
原创 1004 Counting Leaves (30)
#include#includeusing namespace std;class CA{public: enum{N=100}; void run(); void findroot(); void count(int father); void print();private: int n,m; int tree[N][N]; int
2014-02-16 13:16:05 446
原创 1003 Emergency (25)
这个程序抄来的。#include#includeusing namespace std;class CA{public:enum{N=500,INF=0x6FFFFFFF};void getmax(int k,int curteams);void run();void getleastlen();private:int n,m,c1,c2;i
2014-02-16 10:57:02 423
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人