自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(91)
  • 收藏
  • 关注

原创 How Neural Networks Extrapolate:From Feedforward to Graph Neural Networks ICLR2021最高分论文解析

How Neural Networks Extrapolate:From Feedforward to Graph Neural Networks ICLR2021最高分论文解析本篇论文由MIT的研究生keyulu Xu 继2020ICLR高分论文《What can neural networks reason about?》之后的又一力作,由于此篇论文大量的用到了上述论文的概念知识,所以这里贴出上篇论文的解析What can neural networks reason about?解析评审人所给

2021-03-19 11:34:39 1150 1

原创 Towards K-means-friendly Spaces: Simultaneous Deep Learning and Clustering解析

Towards K-means-friendly Spaces: Simultaneous Deep Learning and Clustering解析因为最近会经常用到聚类,并且对于深度聚类的了解较少,所以准备从这篇比较经典的开始,论文地址:论文地址论文代码:代码背景大多数的学习任务都需要用到降维和聚类,不过一般来说都是分开进行降维和聚类的,但是最近的研究表明同时优化两种任务,这两者可以相互提升性能。K-means一般只适合聚类K-means友好型数据,即样本在聚类中心周围均匀的分布,所以我们

2021-03-31 22:04:22 1758 2

原创 What can neural networks reason about?论文解析

What can neural networks reason about?ICLR2020高分论文解析论文地址:论文地址最近在看这篇论文作者MIT研究生keyulu Xu的2021ICLR最高分论文时,发现很多地方与此片论文有联系,所以先回头来看看他2020年的论文。论文干了什么此篇论文正式定义此算法比对,并得出样本复杂度界限,并且该界限随着更好的比对而降低。并且作者展示GNNs和DP(动态规划)问题的对比,发现GNNs很有希望取解决DP等问题,在几个推理任务上,(Summary statisti

2021-03-16 18:15:24 874 1

原创 torch 删除tensor全0列

torch 删除tensor全0列在pythorch中并没有直接的包可以删除元素,所以我们需要自己写def del_tensor_0_cloumn(Cs): idx = torch.where(torch.all(Cs[..., :] == 0, axis=0))[0] all = torch.arange(Cs.shape[1]) for i in range(len(idx)): all = all[torch.arange(all.size(0))!=idx

2021-01-23 11:21:41 4108

原创 python 二维list根据内容长度排序

import numpy as npC = []C.append([1,2])C.append([1,2,3,4])C.append([1,2])C.append([1,5,3,6,9])m = [] n = []temp = []res = []for x in C: m.append(len(x)) n.append(len(x))m.sort(reverse=True)index = 0for i in m: temp.append(C[n.inde

2020-09-10 15:40:00 770 1

原创 多项式拟合(不调包,线性回归)

做一个三阶多项式拟合| python代码import numpy as npimport matplotlib.pyplot as plttemp = np.loadtxt("sin_data.csv", delimiter=',')# print(temp)X = temp[:, 0].reshape(1, -1) #x,y都转成n,1的矩阵Y = temp[:, 1].reshape(1, -1)n_x = 100print(n_x)W1 = np.zeros(shape=

2020-06-17 16:49:14 345

原创 实验7-1-10 交换最小值和最大值 (15分)

本以为两分钟就写得出来,没想到还是花了我5分钟QAQ有提示就是好,要是复试上机每个测试点也有提示就好了!#include <stdio.h>int main(){ int n,i,max=0,min=0,maxnum=-12220,minnum=12220; scanf("%d",&n); int a[n]; for(i=0;i<n;i++){ scanf("%d",&a[i]); if(maxnum.

2020-05-14 15:09:31 2397

原创 1008 数组元素循环右移问题 (20分)测试点1,2

#include <stdio.h>int main(){ int n,m,i; scanf("%d %d",&n,&m); int a[n]; for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(i=0;i<n;i++){ if(i==0) printf("%d",a[(i+2*n-m)%n]); //测试点1、2.

2020-05-13 11:09:38 520

原创 1049 数列的片段和 (20分)

首先,直接暴力算法,但是最后两个测试点超时了#include <stdio.h>//int main(){// int n,i,j,k=0,num;// scanf("%d",&n);// double a[n];// double count = 0;// for(i=0;i<n;i++){// scanf("%lf",&a[i]);// }// for(i=0;i<n;i++){// num = i;// .

2020-05-11 16:43:58 92

原创 7-2 然后是几点 (15分)

要设置很多变量就是取名字有点麻烦,题不是难题,各种if else就可以做,逻辑清晰的话很快就能AC#include <stdio.h>int main(){ int originTime,addTime,curTime; scanf("%d %d",&originTime,&addTime); int addh = addTime/60; int addf = addTime%60; int i=0; int orih = originTime/1.

2020-05-11 09:09:57 272 1

原创 (考前复习)7-1 厘米换算英尺英寸 (15分)

/*这道题给的公式真的看晕了,实际上,foot就是整数部分,inch就是小数部分然后*12 前面一直理解成换算成 米/0.3048后 要/12为foot,剩下的余数为inch , 根本理解错误了 都怪这个公式给的 _(¦3」∠)_*/#include <stdio.h>int main(){ int lon,foot,inch; double mi; scanf("%d",&lon); mi = lon*1.0/100;//换算成米的单位 mi = m.

2020-05-10 11:18:53 848 1

原创 7-21 求特殊方程的正整数解 (15分)

#include <stdio.h>#include <math.h>int main(){ int n,x,y,flag=0; scanf("%d",&n); for(x=1;x<sqrt(n/2);x++){ //这里要小于sqrt(n/2)是因为答案会多一倍,后半部分的答案就是前半部分的x,y颠倒,毕竟这个方程x和y是等价的! int temp = n-x*x; y = (int)sqrt(temp); if(sqrt(.

2020-05-10 10:25:53 272

原创 1042 字符统计 (20分)测试点一分析

测试点一分析:只有一个字母,所以maxEn初始要设置成最大的字母即是’z’,不要设成第一个字符,因为很有可能第一个字符不是字母/*测试点一:只有一个字母,所以maxEn初始要设置成最大的字母即是'z',不要设成第一个字符,因为很有可能第一个字符不是字母*/#include <stdio.h>int main(){ char str[1001]; int set[256]={0}; gets(str); int i; for(i=0;str[i]!='\0';i++.

2020-05-09 11:18:00 350

原创 (复习)1040 有几个PAT (25分)

本题参考了大神的思路,是真的好/*思路;每次扫描到A,用这个A组成的PAT刚好是A前面的P数量*A后面T的数量。so,遍历一遍字符串,存下每个位置前面A的数量。然后从后遍历计数T的数量,扫描到A 就总数加上 A前面的P数量*A后面T的数即可然后每次sum要相加都两次取模。*/#include <stdio.h>#include <string.h>int main(){ char a[100001]; gets(a); int len = strle.

2020-05-09 10:43:55 112

原创 (考前复习!)7-15 计算圆周率 (15分)

最开始的代码,但是一直都错#include <stdio.h>double getJc(double a);int getFm(int a);int main(){ double threshold; scanf("%lf",&threshold); double pi=0; double i=0; double a = getJc(i)*1.0...

2020-05-08 10:54:10 161

原创 1033 旧键盘打字 (20分)

#include <stdio.h>int main(){ char bad[100001]; char realbad[100001]; char origin[100001]; gets(bad); gets(origin); int i,j=0,flag = 0;//flag标志上档键有没有坏 for(i=0;bad[i]!='\0';i++){...

2020-05-07 10:37:46 102

原创 1001 A+B Format (20分)

#include <stdio.h>#include <stdlib.h>int f = 0,count = 0;char str[13];void printN(int n);int main(){ int a,b; scanf("%d %d",&a,&b); int res = a+b; if(res==0){ pr...

2020-05-06 15:17:36 186

原创 (C语言复习)1029 旧键盘 (20分) 测试点4分析

第一次的代码测试点4报错,后来才发现while(originStr[i]!=’\0’&&realStr[j]!=’\0’){ //这个判断条件就很可能导致,最后一个测试点不通过,因为实际输入的文字串结束而应该输入的文字串未结束时,应该输入的文字串后面可能还会有一些坏键,由于循环已经退出,它们将不能输出,从而导致错误。#include <stdio.h>int ...

2020-05-06 11:29:21 1328 1

原创 1024 科学计数法 (20分)

本题用字符串的方式求解,往后往前移动小数点的时候稍微有点绕,边测试边修改代码及即可AC代码#include <stdio.h>int main(){ char str[10001]; int flag = 0;//标志位 gets(str); if(str[0]=='-') printf("-"); int i=0,j; while(str[...

2020-05-05 11:58:06 143

原创 (进制转化考前必看)1022 D进制的A+B (20分)

第一遍就AC了,递归的思想:1,先找出口,这里的出口就是前两个if2,从宏观上来看,每一步要做的是什么。#include <stdio.h>void printHex(int num,int hex);int main(){ int A,B,hex; scanf("%d %d %d",&A,&B,&hex); int res = A+...

2020-05-05 09:50:49 87

原创 复习1017 A除以B (20分)测试点1

测试点1:天坑,如果被除数只有一位并且还没有除数大,那么就应该输出0 被除数,例如: 5 7,输出 0 5(不是0 7哦)!!!!!#include <stdio.h>#include <string.h>int main(){ char a[1001]; int res[1001]; int top = 0; int b,i,temp,c=0;...

2020-05-01 20:13:50 608 2

原创 L2-015 互评成绩 (25分)

/*思路: 一行一行的判断, 输入一行就排序,去掉两端,求平均 吧平均的存入avr[N]中,再对AVR排序,输出最后M个*/#include <stdio.h>#include <stdlib.h>int cmp(void const *a,void const *b);int cmp2(void const *a,void const *b)...

2020-04-30 11:12:02 402

原创 (qsort方法排序flaot类型的数)6-11 求自定类型元素序列的中位数 (25分)

#include<stdlib.h>int cmp(void const *a,void const *b){ return (*(ElementType*)b)>(*(ElementType*)a) ? 1:-1; //因为题中说的是第(N+1)/2大的,所以要逆序。}ElementType Median( ElementType A[], int N ){...

2020-04-29 10:42:38 88

原创 6-10 阶乘计算升级版 (20分)

由于N很大了过后,就超过了int的范围了,故我们只能用数组模拟乘法AC代码void Print_Factorial ( const int N ){ if(N<0){ printf("Invalid input"); return; } int num[1000000] = {0}; int i,j,k=0,temp,y=0;//y是余数,k代...

2020-04-28 15:45:27 144

原创 L2-011 玩转二叉树 (25分)

#include <stdio.h>#include <stdlib.h>typedef struct node{ int data; struct node *left; struct node *right;}*BiTree;BiTree createTreeByInAndPreOrder(int *In,int *Pre,int ...

2020-04-26 10:44:16 253

原创 L2-009 抢红包 (25分)

本题要注意的点是:如果收入金额有并列,则按抢到红包的个数递减输出;如果还有并列,则按个人编号递增输出。 刚开始没有仔细看题导致第一个测试点一直不能通过,最好理解的方法就是用结构体。AC代码 C语言#include <stdio.h>#include <stdlib.h>struct people{ int Ssno; //编号 int Sm...

2020-04-25 11:21:57 644

原创 (考前必看)L2-008 最长对称子串 (25分)

#include<stdio.h>#include<string.h>char str[1010];int main(){ int i,j,n,m,k,t,l; gets(str); l=strlen(str); for(i=l-1;i>=2;i--) { for(j=0;j+i<l;j++) ...

2020-04-25 09:39:41 410

原创 L2-006 树的遍历 (25分)

解析:通过递归的方法从树根向下依次构造一颗二叉树,然后通过层次遍历该树。所以根据中序和任意一个其他序列构造一颗二叉树的方法只需掌握一种,便可以推出另外一种的写法。AC代码:#include <stdio.h>#include <stdlib.h>typedef struct node{ int data; struct node *left; ...

2020-04-23 10:14:40 548

原创 L2-003 月饼 (25分)

/*本题需要注意的是,除了种类和最大需求量是整型数据,其他数据皆是小数,这意味着库存量也是小数而不是正整数,这个点是测试点2所要求的,如果不注意数据类型,很容易被卡住。*/#include <stdio.h>struct yuebin{ //注意必须全是double不然测试点2过不去 double AllPrice; double AllTo...

2020-04-22 10:39:53 322

原创 自测-5 Shuffling Machine (20分)

#include <stdio.h>#include <stdlib.h>#include <string.h>char cards[55][4] = {"S1","S2","S3","S4","S5","S6","S7","S8","S9","S10","S11","S12","S13","H1","H2","H3","H4","H5","H6",...

2020-04-21 11:05:58 72

原创 自测-4 Have Fun with Numbers (20分)

Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number con...

2020-04-20 17:25:06 180

原创 自测-2 素数对猜想 (20分)

#include <stdio.h>#include <math.h>int PutIndexToPrim(int index);int main(){ int n,num,i=1,count=0,d; scanf("%d",&num); while(PutIndexToPrim(i+1)<=num){ d =...

2020-04-20 16:24:39 112

原创 自测-1 打印沙漏 (20分)

只要细心一步步来就可以做出来#include <stdio.h>#include <stdlib.h>int GetL(int num);int main(){ int num,i,j; char ch; scanf("%d %c",&num,&ch); int l = GetL(num); //上半部分有多高,包...

2020-04-20 15:47:00 109

原创 (考前复习)基础实验3-2.2 单链表分段逆转 (25分)

单链表逆序不一定要用头插法从新建一个链表,可以节点间的交换/*思路:*/void K_Reverse( List L, int K ){ List H = (List)malloc(sizeof(struct Node)); H->Next = NULL; int i = 0,len=0,cnt; List p = L->Next,q = L,...

2020-04-20 10:19:24 954

原创 进阶实验2-3.3 两个有序链表序列的交集 (20分)

#include <stdio.h>#include <stdlib.h>typedef struct node{ int data; struct node *next;}*LinkList;LinkList createList();void FindMixed(LinkList L1,LinkList L2);int main(){...

2020-04-17 11:01:41 691

原创 步进电机

步进电机是一种将电脉冲转化为角位移的执行机构。通俗一点讲:当步进驱动器接收到一个脉冲信号,它就驱动步进电机按设定的方向转动一个固定的角度(即步进角),多用于雕刻机、3D打印机等需要精确控制的设备。本篇使用ULN2003驱动五线四相减速步进电机。步进电机每次能转动的最小角度叫做步距角。每当步进电机接收到一个驱动信号后,步进电机将按照一定的方向转动一个固定的角度。通过控制脉冲的个数来精确的控制步...

2020-04-16 16:33:58 831 1

原创 Arduino单片机 +resp8266接收数据(搞了一个星期)

原材料:Arduino Nano 单片机一个 这里我用的nanoesp8266首先接线要注意的就是esp8266上的CH_DP或者EN要接3.3V其他的按照规律接就可以了!我想做的是一个远程控制舵机运转,把Arduino单片机上的esp8266设置为一个UDP(由于UDP是平等的不存在主从的区别)刚开始的想法是串口接收到指令然后舵机运转,结果想要瘦串口的的数据的时候发现一直出现ERROR...

2020-04-15 18:24:04 2091 2

原创 L1-059 敲笨钟 (20分) C语言

需要操作字符串的这类题一定不要操作字符串然后打印字符串,方法一定是不用修改字符串,直接打印部分字符串+遇到要修改的地方再加上题目要求的字符串打印#include <stdio.h>#include <stdlib.h>#include <string.h>int main(){ int n,i,j,flag = 0,k; scanf(...

2020-04-10 16:59:39 1013

原创 L1-058 6翻了 (15分)

思路:不要想着去操作字符串的删减,直接遍历字符串不是‘6’的字符直接打印,出现6再判断有几个6,在做相应打印操作。#include <stdio.h>#include <stdlib.h>#include <string.h>int main(){ char str[1001]; gets(str); int i,count=...

2020-04-10 16:23:17 420

原创 L1-054 福到了 (15分) C语言

#include <stdio.h>int main(){ char flag,ch; int i,n,j,count=0; scanf("%c%d",&flag,&n); getchar(); //接收缓冲区中的回车 char arr[n+1][n+1]; for(i=0;i<n;i++){ ...

2020-04-10 11:12:01 2490

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除