#include <iostream> using namespace std; class LNode { friend class List; public: LNode():m(0),next(0){} private: int m; int num; LNode *next; }; class Head { friend class List; public:
FibonacciTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6946 Accepted: 4908DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0,
Vases and FlowersTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 728 Accepted Submission(s): 251Problem Description Alice is so popular that she can receive many flowers everyday. She has N
一個簡單的並查集的運用、、、找到與第一個有關係的人、、#include <stdio.h>#include <stdlib.h>#define MAXN 30010int p[MAXN];int find_f(int x){ return p[x] == x ? x : (find_f(p[x]));}void rank(int a, int b){ int x = find_f(a), y = find_f(b); if(x != y) p[x] =
FibonacciTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6881 Accepted: 4873DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0,
比賽時一直錯貼的葉找的代碼:#include <string.h>#include<stdio.h>#include<algorithm>using namespace std;#define MAXN 10000const int mod[20]={1,1,2,6,4,2,2,4,2,8,4,4,8,4,6,8,8,6,8,2};//列出錢20個的階層最後一位int ld(char* buf){ int len = strlen(buf),
A Bug's LifeTime Limit: 10000MS Memory Limit: 65536KTotal Submissions: 23484 Accepted: 7639DescriptionBackground Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and