首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
课程
专栏·文章
竞赛
搜索
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
在线笔面试、雇主品牌宣传
登录
/
注册
Luka_2001
获赞
0
粉丝
0
关注
0
看过 TA
4
北京邮电大学
2024
算法工程师
IP属地:北京
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑Luka_2001吗?
发布(17)
刷题
Luka_2001
03-02 11:51
北京邮电大学 计算机类
题解 | #寻找大富翁# 贴一个优先队列
#include <iostream> #include<queue> using namespace std; int main() { int n,m; while(cin>>n>>m){ if(!n && !m) break; priority_queue<int,vector<int>,less<int>>pq; int *arr=(int *)malloc(sizeof(int)*n); for(int ...
0
点赞
评论
收藏
转发
Luka_2001
02-29 12:03
北京邮电大学 计算机类
题解 | #整型存储# 按要求定义了一个类
#include <iostream> #include<vector> #include<algorithm> using namespace std; class solution{ public: vector<pair<int,int>>ints; bool input(int x){ if(ints.size()==10) return true; string y=to_string(x); reverse(y.begin(),y.end()); ...
0
点赞
评论
收藏
转发
Luka_2001
02-19 13:17
已编辑
北京邮电大学 计算机类
#计算表达式# 其实只需要分两种情况,不需要加额外运算符
#include <iostream> #include<stack> #include<string> using namespace std; double operation(double x, double y, char op) { //计算,注意结果有小数 double res=0; if (op == '/') res= x / y; else if (op == '*') res= x * y; else if (op == '-') res=x - y; else res= x + y; r...
0
点赞
评论
收藏
转发
Luka_2001
02-18 23:56
北京邮电大学 计算机类
题解 | #二叉排序树# 还真是二叉链表
#include <iostream> using namespace std; typedef struct Treenode { struct Treenode* left; struct Treenode* right; int val; }*Tree; void insert(Tree &root, int x) { if (!root) { root = (Treenode*) malloc(sizeof(Treenode)); root->left = nullptr; r...
0
点赞
评论
收藏
转发
Luka_2001
02-18 13:40
已编辑
北京邮电大学 计算机类
题解 | #八皇后# DFS清晰注解
#include <iostream> #include<vector> using namespace std; vector<int>res; vector<vector<int>>board(8,vector<int>(8,0)); //棋盘 bool judge(int x,int y){ //能否放置 for(int i=0;i<x;i++){ if(board[i][y]) return false; //判断列(行无须判断) int j...
0
点赞
评论
收藏
转发
Luka_2001
02-17 22:19
北京邮电大学 计算机类
题解 | #最大上升子序列和#
#include <iostream> using namespace std; int main() { int n; while(cin>>n){ int *dp=(int *)malloc(sizeof(int)*n); int *arr=(int *)malloc(sizeof(int)*n); for(int i=0;i<n;++i){ cin>>arr[i]; dp[i]=arr[i]; } in...
0
点赞
评论
收藏
转发
Luka_2001
02-17 13:05
北京邮电大学 计算机类
题解 | #Fibonacci# 记录访问过的数
#include <iostream> #include<vector> using namespace std; vector<int>fibonacci(31,-1); int fibo(int n){ if (n==0) return 0; if(n==1 || n==2) return 1; int x,y; if (fibonacci[n-2]==-1){ fibonacci[n-2]=fibo(n-2); } x=fibonacci[n-2]; if (fibonacci...
0
点赞
评论
收藏
转发
Luka_2001
02-17 12:43
北京邮电大学 计算机类
题解 | #找位置# map+vector
#include <iostream> #include<map> #include<vector> using namespace std; int main() { string str; while(cin>>str){ map<char, vector<int>> m; //哈希表 vector<char>set; //由于map输出的顺序和输入不一致,用一个vector记录输入顺序 for(int i=0;i<str.s...
0
点赞
评论
收藏
转发
Luka_2001
02-16 23:31
北京邮电大学 计算机类
题解 | #邮票# 进行一个穷的举
#include <iostream> #include<set> using namespace std; int main() { set<int>s; for(int i=0;i<=5;++i){ for(int j=0;j<=4;++j){ for(int k=0;k<=6;++k){ s.insert(i*8+j*10+k*18); } } } cout<<s.size()-...
0
点赞
评论
收藏
转发
Luka_2001
02-16 22:50
北京邮电大学 计算机类
题解 | #最小邮票数# 容易理解的背包问题
#include <iostream> #include<vector> #include<algorithm> using namespace std; int main() { int m,n; while(cin>>m>>n){ int *arr=(int *)malloc(sizeof(int)*(n+1)); for(int i=1;i<=n;++i) cin>>arr[i]; vector<vector<int>>dp...
0
点赞
评论
收藏
转发
Luka_2001
02-16 16:04
北京邮电大学 计算机类
题解 | #反序相等# int->string->int
#include <iostream> #include<string> #include<algorithm> using namespace std; int reverse_(int x){ string str=to_string(x); reverse(str.begin(),str.end()); return stoi(str); } int main() { for(int i=1000;i<9999;++i){ if (i*9==reverse_(i)){ c...
0
点赞
评论
收藏
转发
Luka_2001
02-13 13:07
北京邮电大学 计算机类
题解 | #三角形的边# 非常简洁的解法
#include <iostream> using namespace std; int main() { int a, b,c; while (cin >> a >> b>>c) { if(a&&b&&c) cout<<a+b+c-max(a,max(b,c))*2<<endl; } }
0
点赞
评论
收藏
转发
Luka_2001
02-13 12:58
北京邮电大学 计算机类
题解 | #畅通工程#
#include <iostream> #include<algorithm> using namespace std; const int maxnum=101; int points[maxnum]; int height[maxnum]; struct path{ int from; int to; int weight; } paths[maxnum*(maxnum-1)/2]; bool compare(path p1,path p2){ return p1.weight<p2.weight; } void init...
0
点赞
评论
收藏
转发
Luka_2001
02-13 11:22
北京邮电大学 计算机类
题解 | #IP地址#
#include <iostream> #include<cstdlib> #include<string> using namespace std; int main() { string str; while(cin>>str){ int i=0,len=0,flag=0; //i和len标识当前整数 for(int j=0;j<str.size();++j){ if(str[j]=='.'){ //判断+更新 ...
0
点赞
评论
收藏
转发
Luka_2001
02-12 23:18
北京邮电大学 计算机类
题解 | #全排列#简简单单深度优先遍历
#include <iostream> #include<string> #include<vector> using namespace std; vector<string>res; //保存结果 void dfs(string s,string cur){ if (s=="") res.push_back(cur); for(int i=0;i<s.size();++i){ char tmp=s[i]; s.erase(i,1); ...
0
点赞
评论
收藏
转发
1
2
工具箱
TA的圈子
暂未加入圈子
TA的圈子
TA的笔记
暂无笔记
TA的笔记
登录
0
天
已登录
0
天
连续登录
0
人
今日访客
牛客网
牛客企业服务