
BUPT
普通网友
这个作者很懒,什么都没留下…
展开
-
BUPT OJ 统计节点个数
#include#define MAXSIZE 1000using namespace std;class node{ public: int degree; int parent; int numOfSon; int son[1000]; node() { degree=0; parent=0; numOfSon=0; }};class原创 2017-01-14 16:10:14 · 359 阅读 · 0 评论 -
单调递增最长子序列
南阳理工oj数据比较弱。。。#include#include#define MAX_SIZE 10002using namespace std;char str[MAX_SIZE];int cost[MAX_SIZE];int main(){ int t; int len; cin>>t; char c; while(t--) { cin>>str;原创 2017-03-06 23:06:44 · 304 阅读 · 0 评论 -
BUPT OJ 丁神又去谷歌
/*USER_ID: test#bupt_wcyPROBLEM: 417SUBMISSION_TIME: 2017-03-10 12:05:45*/#include#include#define MAXSIZE 10002using namespace std;// DPint n;int a[MAXSIZE];long long b[MAXSIZE];// f[i][j原创 2017-03-10 12:11:20 · 507 阅读 · 0 评论 -
一笔画问题(南阳理工oj)
#include#includeusing namespace std;int a[1001];int fa[1001];int find(int i){ while(i!=fa[i]) i=fa[i]; return i;}void join(int i,int j){ int fa_i=find(i); int fa_j=find(j); if(fa_i!=原创 2017-03-05 20:54:04 · 700 阅读 · 0 评论 -
BUPT OJ 非平方等式
纯粹数学题。如果无脑直接枚举肯定超时。所以我就超时了。。。后来分析了一下。x^2+s(x)*x-n=0,能拆开成 x*(x+s(x))=n的形式,由于n小于10^18次方,x最大s(x)=162,所以能够得到不等式 sqrt(n)-162剩下的就没啥了/*USER_ID: test#bupt_wcyPROBLEM: 130SUBMISSION_TIME: 2017-01原创 2017-01-26 21:18:18 · 798 阅读 · 0 评论 -
BUPT OJ 中序遍历树
水题。开始看错,当成按照每个节点代表的字符顺序访问了,后来改完就可以了。#include#include#includeusing namespace std;char func[101];bool relation[100][100]={false};bool visited[100]={false};string result;string temp;void dfs原创 2017-01-24 15:43:01 · 903 阅读 · 0 评论 -
BUPT OJ 虚数
#include#include#include#includeusing namespace std;class complex{ public: int real; int image; complex(int a=0,int b=0) { real=a; image=b; } };class cmp{ public: bool operator()(原创 2017-01-23 18:29:37 · 467 阅读 · 0 评论 -
BUPT OJ 寻找宝藏
水题#include#includeusing namespace std;class node{public: int parent; int branches; node() { branches=0; parent=-1; }};const int MAXSIZE = 10000;class tree{public: node point[MAXSIZ原创 2017-01-23 14:48:16 · 431 阅读 · 0 评论 -
BUPT OJ IP地址
水题#include#includeusing namespace std;inline bool ipstring(string ip){int threes=0;for(int i=0;i{if(ip[i]=='.')threes++;} return threes==3&&ip[ip.size()-1]!='.'&&ip[0]!='.';原创 2017-01-18 16:12:50 · 915 阅读 · 0 评论 -
BUPT OJ 矩阵幂
水题#include#include#define MAXSIZE 10using namespace std;int k;class matrix{ public: int n; int metric[MAXSIZE][MAXSIZE]; friend ostream& operator<<(ostream&out,matrix &a); friend istream&原创 2017-01-15 12:36:13 · 326 阅读 · 0 评论 -
BUPT OJ 最小距离查询
用了类似邻接表的结构,一个vector,存放每种字母对应的出现位置,并在插入时排序。用cin超时,scanf通过。。。 怪不得连题目描述里#include#include#include#include#include#include#define MAXSIZE 100001using namespace std;class node{ public:原创 2017-01-14 23:06:13 · 412 阅读 · 0 评论 -
BUPT OJ 中序遍历序列
水#include#include#includeusing namespace std;int main(){ int t,n,x; cin>>t; while(t--) { vectorBeforeSort; vectorAfterSort; cin>>n; while(n--) { cin>>x; BeforeSor原创 2017-01-14 16:28:01 · 361 阅读 · 0 评论 -
Hadoop 经典案例:词频统计
全文作为个人记录用。不做任何参考。环境搭建参考:http://www.ityouknow.com/hadoop/2017/07/24/hadoop-cluster-setup.html词频代码参考:https://blog.youkuaiyun.com/a60782885/article/details/713082561、环境搭建总共选择了3台虚拟机作为本次的主角master:192.168.21.130s...转载 2018-04-07 14:09:15 · 15772 阅读 · 0 评论