- 博客(65)
- 收藏
- 关注
原创 2021-03-05
步入新的校区了 要好好学习 成为一名NLPer!虽然进组1年了,但是核心的代码东西一点都讲不出来该博客将记录学到的东西 每天的新知识 论文翻译 小实战 心得体会能看到我博客的都是有缘人...
2021-03-05 21:34:34
170
原创 9.16。10
#include <iostream>#include <algorithm>#include <string.h>#include <math.h>using namespace std;bool su(int a){// 判断是否为素数 if (a<2) { return false; } for(...
2019-09-16 22:04:31
236
原创 9.15+9.16 刷题记录
#include #include #include <string.h>#include <math.h>using namespace std;int main(){double sum;int n,x[10000],y[10000];while(scanf("%d",&n)!=EOF){if (n==0) {break;}sum=0;...
2019-09-16 14:15:07
184
原创 人人都爱A-B 待改
#include #include #include <string.h>#include <math.h>using namespace std;int main(){int n,m;int judge;int a[2][10000]={0},b[10000];while(1){judge=0;scanf("%d%d",&n,&m);...
2019-09-14 23:20:34
1090709
原创 hdoj 2004 a小于0的情况也要考虑 2005闰年标志 2006
#include #include #include <string.h>#include <math.h>using namespace std;int main(){int a;while (scanf("%d",&a)!=EOF) {if(a>100||a<0){printf(“Score is error!\n”);} ...
2019-09-14 23:09:39
159
原创 hdoj 2003
#include #include #include <string.h>#include <math.h>using namespace std;#define PI 3.1415927int main(){double count;while(scanf("%lf",&count)!=EOF){if (count<0) {printf(...
2019-09-14 16:07:21
166
原创 hdoj2003
#include #include #include <string.h>#include <math.h>using namespace std;#define PI 3.1415927int main(){double r;while(scanf("%lf",&r)!=EOF){ double v=4*PI*r*r*r/3; pr...
2019-09-14 15:46:26
133
原创 hods2001 实数double 输入lf 输出f
#include #include #include <string.h>#include <math.h>using namespace std;int main(){double x1,x2,y1,y2;while(scanf("%lf %lf %lf %lf",&x1,&x2,&y1,&y2)!=EOF){double ...
2019-09-14 15:38:13
276
原创 hdoj 2000
#include #include #include <string.h>using namespace std;int main(){char a[3];int x;while(cin>>a){x=strlen(a);sort(a, a+x);for (int i=0; i<x-1; i++) {printf("%c “,a[i]);}pr...
2019-09-14 15:26:28
177
原创 PAT A1004 Counting Leaves
题目计算每层各有多少叶子结点code#include <cstdio>#include <algorithm>#include <vector>#include <cmath>using namespace std;const int N=110;vector<int>G [N];int leaf[N]={0};/...
2019-05-13 22:06:57
151
原创 PAT A1106 Lowest Price in Supply Chain
题目找深度最小的叶子结点code#include <cstdio>#include <algorithm>#include <vector>#include <cmath>using namespace std;const int maxn=100100;const int INF=1e12;vector<int>N...
2019-05-13 21:45:46
175
原创 PAT A1094 The Largest Generation (25 point(s))
#include <cstdio>#include <algorithm>#include <vector>#include <cmath>using namespace std;const int maxn=110;struct node{ int parent; vector<int> child;}id...
2019-05-06 22:11:54
145
原创 PAT A1079 Total Sales of Supply Chain (25 point(s))
题目Code#include #include #include #include using namespace std;const int maxn=100100;struct node{double data;vector child;}Node[maxn];int n;double p,r,ans=0;void DFS(int index,int depth...
2019-05-03 21:24:30
189
原创 PAT A1090 Highest Price in Supply Chain
code#include <cstdio>#include <algorithm>#include <vector>#include <cmath>using namespace std;const int maxn=10000;vector<int> child[maxn];double p,r;int n,maxDe...
2019-05-03 20:58:47
194
原创 并查集入门总结
模板定义const int N=110;int father[N];初始化for(int i=1;i<=n;i++){//首先让所有的个体都独自称为一个集合 father[i]=i;}查找-递归int findFather(int x){ while(x!=father[x]){ x=father[x]; } return x; }查找-迭代int...
2019-04-13 11:26:06
168
原创 PAT A1102 Invert a Binary Tree
题目code# include <cstdio># include <queue># include <stack># include <algorithm># include <cstring>using namespace std;const int maxn=110;struct node{ int lc...
2019-03-29 21:38:49
199
原创 PAT A1086 Tree Traversals Again
题目思路push 为先序遍历根据题目第一句话 pop为中序遍历即知道先序遍历和中序遍历来求得后序遍历的顺序根据先+中= 构建树根据树后序遍历在主函数中针对不同的字符串输入需要利用栈分别存在2个数组里。code # include <cstdio># include <queue># include <stack># include...
2019-03-26 22:00:25
185
原创 PAT A1020 Tree Traversals
题目简单来说就是 知后序遍历和中序遍历求层次遍历思路先根据后序遍历和中序遍历建出二叉树BFS求层次遍历code# include <cstdio># include <queue># include <algorithm># include <cstring>using namespace std;struct node{...
2019-03-25 21:10:57
195
原创 二叉树入门-基础知识
1基础1 .1 二叉树的链表结构struct node{ typename data; node* lchild; node* ychild;};建立树前根节点不存在 因此初始化为node* root=NULL;1.2建立新结点node* newNode(int v){//v为权值 node* Node=new node; Node->...
2019-03-25 20:23:37
308
原创 START BFS深度优先遍历-队列
题目寻找有几个块code#include<cstdio>#include <queue>using namespace std;const int maxn=100;struct node{ int x,y;}Node;int n,m;int matrix[maxn][maxn];bool inq[maxn][maxn]={false};//记...
2019-03-23 21:37:43
209
原创 START 深度优先遍历DFS_栈
#include <cstdio>const int maxn=30;int n,V,maxValue=0;int w[maxn],c[maxn]; //w[i]为每件物品的质量,c 为每件物品的价值void DFS(int index,int sumW,int sumC){//递归可以很好的实现深度优先遍历 if(index==n){//死胡同 已经完成了对于n件物品的...
2019-03-21 11:06:00
208
原创 PAT A1097 Deduplication on a Linked List
题目code#include <cstdio>#include <algorithm>#include <cstring>using namespace std;const int maxn=100010;const int Table=100020;struct Node{//建立静态链表 int data; int next...
2019-03-19 20:54:45
133
原创 PAT A1052 Linked List Sorting
题目code#include <cstdio>#include <algorithm>#include <cstring>using namespace std;const int maxn=100010;struct Node{ int data; int next; int address; bool flag...
2019-03-19 16:34:36
197
原创 PAT A1032 Sharing
题目code#include <cstdio>#include <string>const int maxn=100010;struct Node{//定义静态链表 char data; int next; bool flag;//随题目改变}node[maxn];int main(){ int s1,s2,n; sc...
2019-03-18 20:56:03
124
原创 PAT A1060 Are They Equal
#include <string>#include <iostream>using namespace std;int N;void getK(string &num,int &n){ while(num[0] == '0') num.erase(num.begin()); if(num.length() == 0){ //处理0 num...
2019-03-17 13:49:39
153
原创 PAT A1058 A+B in Hogwarts
题目code#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;const int Galleon=17*29;const int Sickle=29;int main(){ long lo...
2019-03-14 18:24:30
154
原创 PAT A1027 Colors in Mars
题目请注意审题!你输入的数字decimaldecimaldecimaldecimaldecimaldecimaldecimaldecimaldecimaldecimaldecimaldecimaldecimaldecimal 10进制这个数变为火星上的13进制!!code#include <iostream>#include <algorithm>#inclu...
2019-03-14 16:33:51
153
原创 PAT A1019 General Palindromic Number
题目code#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;bool Judge(int ans[],int num){ for(int i=0;i<num/2;i++){ ...
2019-03-14 15:56:58
173
原创 PAT B1037 在霍格沃茨找零钱
题目code#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;const int Gallon=17*29;const int Sickle=29;int main(){ int ...
2019-03-14 14:58:59
143
原创 PAT B1022 D进制的A+B
题目code#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;int main(){ int a,b,sum,d; scanf("%d%d%d",&a,&b,&..
2019-03-14 14:32:41
113
原创 Codeup1928 日期处理
题目code#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;int isLeap(int year){ if(((year%4==0)&&(year%100!=0))||(ye...
2019-03-13 23:55:45
201
原创 PAT A1031 Hello World for U
题目code#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;int main(){ char str[100],ans[40][40]; scanf("%s",str); i...
2019-03-12 15:03:06
133
原创 PAT B1027 打印沙漏
题目code#include <iostream>#include <algorithm>#include <string>#include <cmath>using namespace std;int main(){ int n,bottom; // n为总字节数 char a; scanf("%d %c"...
2019-03-12 11:51:09
157
原创 PAT B1036 跟奥巴马一起编程.图形输出类
题目code#include <iostream>#include <algorithm>#include <cstring>using namespace std;int main(){ int n,row; char a; scanf("%d %c",&n,&a); if(n%2==0) row=...
2019-03-11 13:23:23
189
原创 PAT B1006 Sign In and Sign Out
题目code#include <iostream>#include <algorithm>#include <cstring>using namespace std;struct timel{ char id[20]; int HH; int MM; int SS;}Time_in,Time_out,Temp1,T...
2019-03-11 11:46:05
197
原创 PAT A1036 Boys vs Girls 版本2有个小问题
题目This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains one ...
2019-03-10 15:22:40
184
原创 PAT A1011 World Cup Betting
题目code#include <iostream>#include <algorithm>#include <string>using namespace std;int main(){ char S[3]={'W','T','L'};// s[0]=W s[1]=T s[2]=L double a,temp,sum; int i...
2019-03-10 13:41:38
142
原创 PAT B1028 人口普查
题目某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。这里确保每个输入的日期都是合法的,但不一定是合理的——假设已知镇上没有超过 200 岁的老人,而今天是 2014 年 9 月 6 日,所以超过 200 岁的生日和未出生的生日都是不合理的,应该被过滤掉。输入格式:输入在第一行给出正整数 N,取值在(0,105 ];随后 N 行,每行给出 1 ...
2019-03-09 21:21:35
135
原创 PAT B 1032 挖掘机技术哪家强
#include &lt;iostream&gt;#include &lt;algorithm&gt;#include &lt;string&gt;using namespace std;int main(){ int n,num,temp,a[1000001]; a[1000000]={0}; scanf("%d",&am
2019-03-08 21:40:53
131
原创 PAT B1001 害死人不偿命的(3n+1)猜想
简单的模拟,while n=1 位临界条件#include <iostream>#include <algorithm>#include <string>int main(){ int step=0,n; scanf("%d",&n); while(n!=1){ if(n%2==0) {...
2019-03-08 20:59:35
188
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人