- 博客(48)
- 收藏
- 关注
原创 Paddlehub安装血泪史
这段时间刚刚入职,要求要学习paddlepaddle,用OCR,我电脑原本就装了cudnn,anaconda这些工具的,因此就直接在现有的环境上安装paddlepaddle。由于太久没有使用anaconda(三年前的了,python3.6),我直接在base环境下装了一下,好像没装上,然后才想到要新建一个虚拟环境 ,在这个虚拟环境中安装paddlepaddle和paddlehub。在这个过程中,paddlepaddle很好装,用 conda install paddle paddle 就可以安装上,
2021-07-16 13:15:51
5670
原创 LeetCode 347 Top K Frequent Elements
题目:Given a non-empty array of integers, return the k most frequent elements.思路:我是用比较暴力的方法求解了一遍,先全部排序,然后用结构体记录每个值的个数,最后按照个数进行排序,取前k个值。struct Node{ int count; int val;};int compare(Node a, Node b) { if (a.count > b.count) r
2020-07-21 16:49:19
243
原创 java笔记
1.构造器构造器负责类中成员变量(域)的初始化2.静态变量 该类中所有对象可共享的变量 属于整个类所有 推荐用类名访问3.静态方法 静态方法中可以直接调用同类中的静态成员,但不能直接调用非静态成员 如果希望在静态方法中调用非静态变量,可以通过创建类的对象,然后通过对象来访问非静态变量 在 普通成员方法 中,则可以 直接 访问 同类的非
2017-11-07 09:07:04
455
原创 hdu1016 Prime Ring Problem
#include#include#include#include#include#include#include#includeusing namespace std;int n, a[21], vid[21];bool isP(int c){ int q = sqrt(c); if (c == 2) { return true;
2017-03-23 23:02:05
359
原创 我的软件工程课目标(作业向)
在这个大三的下学期,我们开始了学习软件工程的课程。作为一名学习软件工程专业的学生,这门课是非常重要的。因此,我需要确定我在软件工程这门课上的目标。根据百度百科,软件工程专业是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科,软件工程的目标是:在给定成本、进度的前提下,开发出具有适用性、有效性、可修改性、可靠性、可理解性、可维护性、可重用性、可移植性、可追踪性、可互操作性和满足用
2017-03-11 15:23:47
1007
原创 hdu 5326 Work
哈哈,放假回家一周啦!这几天真是堕落得不像话(这就是为啥我会一直处在菜鸟阶段。。O.O),今天突然来了兴致开始刷题了。嗯,放着史诗BGM刷题,感觉不错不错!希望在新的一年里面能够勤奋努力学习!(感觉离我还很遥远。。)#include#include#include#include#include#includeusing namespace std;#define MAX_N 100
2017-01-13 15:09:34
389
原创 hdu 1300 Pearls
#include#include#include#include#include#includeusing namespace std;#define MAX_N 100005#define INF 1000000000int main(){ int t, c, a[1003], p[1003], dpp[102]; cin>>t; while (t-
2016-12-19 20:50:42
392
原创 hdu 1158 Employment Planning
#include #include #include #include #include using namespace std;const int MAX = 500005;int dp[13][MAX] = {0};int main(){ int n, h, s, f, p[20], mw; while (cin>>n, n) { cin
2016-12-06 16:04:14
489
原创 hdu2151 worm
#include #include #include #include #include using namespace std;const int MAX = 105;int n, p, m, t, dp[MAX][MAX];int main(){ while (scanf("%d%d%d%d", &n, &p, &m, &t) != EOF) {
2016-12-05 16:29:33
455
原创 hdu 2845 Beans
#include#include#includeusing namespace std;//很多二维的问题能够分解成两个一维的问题int x[200002], y[200002];int main(){ int n, m, a; while (cin>>n>>m) { //顺手就写成了(cin>>n>>m,n|m)然后就TLE了。。。&_&
2016-11-27 10:01:35
352
原创 poj 3641 Pseudoprime numbers
#include #include #include #include #include using namespace std;typedef long long int ll;//好吧,这次是因为没有使用long long。。。。ll mod_pow(ll x, ll n, ll mod){ ll res = 1; while (n > 0) {
2016-11-26 18:24:12
427
原创 hdu 1203 I NEED A OFFER!
#include#include#include#include#include#define min(x, y) (x) < (y) ? (x) : (y)using namespace std; int n, m, a[10002]; double b[10002]; double dp[10002];int main(){ while (c
2016-11-21 13:39:06
357
原创 hdu 1372 Knight Moves
#include#include#include#include#includeusing namespace std;typedef struct Node{ int x, y, stp;}Node;int vid[9][9];int dir[8][2] = {1, -2, -1, -2, -2, -1, -2, 1,
2016-11-20 22:29:20
343
原创 poj 2352 Stars
#include#include#include#include#includeusing namespace std;int n, levels[32005], c[32005];int lowbit(int x){ return x & (-x);}int sum(int x){ int s = 0; while (x > 0) {
2016-11-20 20:58:11
277
原创 hdu 1232 畅通工程
#include#include#include#include#includeusing namespace std;int p[10002];int ra[10002] = {0};void init(int n){ for (int i = 0; i <= n; i++) p[i] = i;}int fd(int x){ if (x
2016-11-20 20:19:33
313
原创 poj 1979 Red and Black
#include#include#includeusing namespace std;typedef struct Node{ int x, y;}Node;int main(){ int m, n, si, sj; int dir[4][2] = {0, 1, 0, -1, 1, 0, -1, 0}; char g[21][21];
2016-11-20 16:00:06
349
原创 hdu 1548 A strange lift
#include#include#includeusing namespace std;typedef struct Node{ int cf, stp;}Node;int main(){ int n, a, b, k[202], ans, vid[202]; while (cin>>n, n) { cin>>a>>b;
2016-11-20 15:40:12
402
原创 poj 1061 青蛙的约会
#includeusing namespace std;typedef long long LL;LL ex_gcd(LL a, LL b, LL &x, LL &y){ if (b == 0) { x = 1; y = 0; return a; } LL ans = ex_gcd(b, a%b, x, y
2016-11-20 14:59:24
378
原创 poj 3050 Hopscotch
这道题我是用一棵高度为 6 的树来存储路径,每一个叶子节点表示一条不同的路径,第k层就表示第k步,每生成一条路径,就从树的根部开始查找,若在第 i 层没有找到该路径下的第 i 步的数字,便添加进树的第 i 层中#include #include #include #include using namespace std;typedef struct Node{ int v,
2016-11-10 11:40:56
452
原创 poj3187 Backward Digit Sums
额。。原本是想从下标1开始全排列的,但我忘了next_permutation()是从下标0开始的了。。。。#include #include #include using namespace std;int n, t, res[12][12], f;int main(){ while (cin>>n>>t) { memset(res, 0, siz
2016-11-10 09:27:12
338
原创 C++ 读取一行带有空格的字符串
char str[30];cin.getline(str, 9); //输入的字符串长度不超过8个,超过后只截取前面部分coutendl;
2016-11-01 19:01:42
4696
原创 数正方形
晓萌有一个N×N的的棋盘,中间有N2个正方形的1×1的格子,他随机在棋盘上撒上一些棋子(假设全部正好落在各个格子里)。他希望知道,当前的棋盘上有多少个不包含棋子的,由至少四个1×1的格子组成的正方形(正方形之间可以有重叠的部分)。样例输入6101111001111111111001111101101111001输出2 103
2016-10-17 17:29:32
762
原创 javascript与Android简单交互
html代码: function callJS(s) { document.getElementById('replace').innerHTML = s; } WebView Display
2016-09-24 11:23:06
927
原创 递归学习(笔记)
定义:将一个大的问题分解成比较小的,有着相同形式的问题。条件:(1)必须能够鉴别出一个简单情景,并且该情景的答案的容易确定的。 (2)必须能够确认一个递归的分解方式,能够将问题的复杂实例分解为更小的,具有相同形式的问题。当计算机完成对递归函数的一次调用时,它执行的是和调用其他函数同样的过程。在理解递归程序时,必须能够抛开底层的细节,将注意力集中
2016-03-23 14:35:53
456
原创 上楼梯
问题描述: 有个小孩正在上楼梯,楼梯有n阶台阶,小孩一次可以上1阶, 2阶, 3阶。实现一个方法,计算小孩有多少种上楼梯的方式。#includeint rec[20];int fun(int n){ if (n == 1) return rec[1] = 1; else if (n == 2) return rec[2]
2016-03-11 22:08:42
649
原创 斐波那契数列
//使用迭代的方式int fun1(int n){ if (n <= 2) return 1; int a, b, c; a = 1; b = 1; for (int i=3; i<=n; i++) { c = a + b; a = b; b = c; } ret
2016-03-03 15:24:05
379
原创 hdu 1003 Max Sum
#include#define MAX 100000int main(){ int n_case, num[MAX], index[MAX], n; scanf("%d", &n_case); for (int k = 1; k <= n_case; k++) { int ans, pos = 0; scanf("%d"
2016-03-03 15:14:20
334
原创 广度优先搜索(bfs)的学习
bfs中,给定图 G = (V, E) 和一个 可以识别的源结点 s, bfs对图G中的边进行系统性的探索来发现可以从源结点s到达的所有的结点。 该算法始终是讲已发现结点和未发现结点之间的边界,沿其广度方向向外扩展。也就是说,算法需要在发现所有距离源结点s为k的所有结点之后,才会发现距离源结点s为k+1的其他结点。 该算法能够计算从源结点s到每个可到达的结
2016-02-13 08:11:20
480
原创 扩展欧几里得的学习
1 概述 扩展欧几里得算法 用来 求解一组x,y,使它们满足贝祖等式: ax+by = gcd(a, b) =d(已知a, b, 且该解一定存在)。扩展欧几里德常用在求解模线性方程及方程组中。2 欧几里得算法 (又称辗转相除法) int gcd(int a, int b){ if (a < b) { in
2016-02-12 23:34:35
394
原创 快速幂的学习
计算 S = a^n :S = a * a * a * a...... = ( ( (a^2)^2)^2)......n = 2^k1 + 2^k2 + 2^k3......例如: 22 = 16+4+2 22的二进制数为:10110那么: a^22 = a^16 * a^4 * a^2int pow(int a, int n){ int res =
2016-02-12 15:56:25
412
原创 01背包的学习
问题描述: 有 n 个重量和价值分别为 w[i], v[i] 的物品。从这些物品中挑选出总重量不超过 W 的物品, 所求有挑选方案中价值中价值总和的最大值。 (限制条件:1 输入:4 5 (n, W)2 3 (w[i], v[i])1 23 42 2输出:7每一件物品有两种结果:放入或是不放入背包。于
2016-02-12 15:08:18
490
原创 并查集的学习
1 定义: 并查集是一种用来管理元素分组情况的数据结构,用于处理一些 不相交 集合的合并及查询问题。其精妙之处在于用树来表示集合。并规定每棵树的根节点就是这棵树所对应的集合的代表元。2 并查集可高效地进行如下操作: (并查集虽然可以进行合并,但无法进行分割) (1)查询元素a和元素b是否属于同一组。 (2)合并元素a
2016-02-11 11:39:34
349
原创 hdu 1097 A hard puzzle (快速幂取模)
#includeint main(){ int a, b; while (~scanf("%d%d", &a, &b)) { int ans = 1; int temp = a%10; //之前这里没有进行取模,就WA了 while (b) { if (b & 1)
2016-02-03 17:15:32
376
原创 hdu 1056 HangOver
#includeint main(){ double leng; double cl; while(scanf("%lf", &leng), leng) { cl = 0; if (leng - 0.5 < 0.000001) { printf("1 card(s)\
2016-02-02 19:31:16
315
原创 hdu 1021 Fibonacci Again
这道题只需要找出 f(n)%3 的循环数列就行了。。。我是先打印出前100个f(n)%3 的数,找到其循环数列为 0, 2, 2, 1, 0, 1, 1, 2(感觉好偷懒。。。)#includeint main(){ int a[8] = {0, 2, 2, 1, 0, 1, 1, 2}; int n; while (~scanf("%d", &n))
2016-02-02 00:30:39
311
原创 hdu 1019 Least Common Multiple
#includeint gcd(int a, int b){ if (a < b) { int x = a; a = b; b = x; } if (a%b == 0) return b; return gcd(b, a%b);}int main(){ int T, a,
2016-02-02 00:01:35
349
原创 hdu 2078 复习时间
#include#include#includeusing namespace std;int main(){ int t; int n, m; int a[101]; int max; scanf("%d", &t); while (t--) { scanf("%d%d", &n, &m); f
2015-12-19 21:26:24
532
原创 HDU 2085 核反应堆
刚开始写时把第0微秒时的初始状态搞错了。。。。。。#includetypedef long long int ll;int main(){ ll a[40][2] = {{1, 0}, {3, 1}, {11, 4}}; //a[i][0], 存放高能质点, a[i][1] 存放低能质点 int n; for (int i=2; i < 40; i++)
2015-12-15 21:59:22
545
原创 HDU 2088 Sky数
#includeint main(){ int n; int temp; while (scanf("%d", &n), n) { int a[3][2] = {10, 0, 16, 0, 12, 0}; for (int i = 0; i < 3; i++) { temp = n;
2015-12-15 21:32:52
499
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅
1