- 博客(17)
- 收藏
- 关注
原创 1046 Shortest Distance (20)(20 分)
#include<iostream>#include<algorithm>using namespace std;const int maxn = 1e5 + 10;int a[maxn], n;int main(){ scanf("%d", &n); int x, tot = 0; for (int i = 1; i <= n; i++)...
2018-08-22 12:01:28 198
原创 1042 Shuffling Machine (20)(20 分)
#include<iostream>#include<string>#include<cstring>using namespace std;const int maxn = 1e3 + 10;int num[maxn], temp[maxn],shuff[maxn], k;void show(int n){ if (n <= 13)pr...
2018-08-22 11:49:38 225
原创 1018 锤子剪刀布(20 分)
#include<iostream>#include<algorithm>#include<map>using namespace std;char num[3] = { 'B','C','J' };int a[3], b[3];int n;int as, ap, af, bs, bp, bf;void show(int a[]){ int...
2018-08-22 11:39:21 677
原创 1012 数字分类 (20)(20 分)
#include<iostream>#include<algorithm>#include<vector>using namespace std;int n, x;vector<int>a[6];int main(){ scanf("%d", &n); while (n--) { scanf("%d", &a
2018-08-22 11:21:41 381
原创 1008 数组元素循环右移问题 (20)(20 分)
#include<iostream>#include<algorithm>using namespace std;const int maxn = 1e4 + 10;int n, m;int a[maxn];int main(){ scanf("%d%d", &n, &m); for (int i = 0; i < n; i++)s...
2018-08-22 11:11:37 327
原创 1046 划拳(15 分)
#include<iostream>#include<algorithm>using namespace std;int n;int main(){ scanf("%d", &n); int acount = 0, bcount = 0; while (n--) { int a, ax, b, bx; scanf("%d%d%d%d", ...
2018-08-22 11:04:37 382
原创 1026 程序运行时间(15 分)
#include<iostream>#include<cmath>#include<algorithm>using namespace std;const int CLK_TCK = 100;int c1, c2;int main(){ scanf("%d%d", &c1, &c2); int t = round((c2 - ...
2018-08-22 10:58:54 496
原创 1016 部分A+B(15 分)
#include<iostream>#include<string>#include<cstring>using namespace std;string a, b;int da, db;typedef long long LL;LL getnum(string s, int d){ int ans = 0; for (int i = 0;...
2018-08-22 10:53:50 248
原创 1011 A+B和C (15)(15 分)
#include<iostream>typedef long long LL;LL a, b, c;int t;int main(){ scanf("%d", &t); for(int i=1;i<=t;i++) { printf("Case #%d: ", i); scanf("%lld%lld%lld", &a, &b, &
2018-08-22 10:49:10 238
原创 1001 害死人不偿命的(3n+1)猜想 (15)(15 分)
#include<iostream>using namespace std;int main(){ int n, ans = 0; cin >> n; while (n != 1) { if (n % 2 == 0)n /= 2; else n = (3 * n + 1) / 2; ans++; } cout << ans; r...
2018-08-22 10:42:50 696
原创 Tensorflow、keras、pytorch、cuda(GPU加速)在Windows10下的配置
之前这些装过好多次,踩了挺多坑的,这次帮同学装,顺手记录一下配置过程目录anaconda安装安装更换源TensorFlow(GPU)GPUCPU(不建议安装CPU版)cuda配置GPU加速cudacudnn建议大家安装anaconda,有挺多同学自己在linux里面自己下载需要的模块,这样也可以,但是不如直接anaconda比较方便,里面有好多库都包含进...
2018-08-06 13:07:09 1642
原创 1079 Total Sales of Supply Chain (25)(25 分)
DFS:递归终点为叶子结点,此时计算乘积#include<iostream>#include<queue>#include<vector>using namespace std;const int maxn = 1e5 + 10;struct node { double p, product; vector<int>child;...
2018-08-06 12:34:29 446
原创 1102 Invert a Binary Tree(25 分)
静态树存储,找一下根节点,遍历的时候左右节点换一下就可以了算法笔记上给的方法是:后序遍历时交换左右子树,重建二叉树,再进行遍历#include<iostream>#include<cstring>#include<queue>#include<vector>using namespace std;int n;const int ...
2018-08-06 10:38:10 844
原创 二叉树、BST、并查集、堆、哈夫曼树
二叉树操作,二叉搜索树操作,先序层序等遍历,树的旋转,并查集,最大堆建立,插入,删除,堆排序、哈弗曼树WPL(带权路径和最大)程序来源于“算法笔记”,复习的时候手写了一遍,基础还是很有用的,这些常用的记一记感觉确实做题的时候顺畅一些#include<iostream>#include<vector>#include<queue>using na...
2018-08-04 23:15:13 281
原创 1043 Is It a Binary Search Tree (25)(25 分)
模板题目:树的创建(插入节点,新建节点),树的遍历(前中后遍历都是DFS)#include<iostream>#include<vector>using namespace std;struct node { int data; node* lchild; node* rchild;};int num[10000], n;node* Newnode(...
2018-08-03 16:10:08 679
原创 1053 Path of Equal Weight (30)(30 分)
典型题目:静态树存储,DFS遍历#include<iostream>#include<vector>#include<algorithm>using namespace std;int n, m, s;const int maxn = 110;struct node { int weight; vector<int>child;...
2018-08-03 14:01:00 547 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人