暑假集训之——sort+结构体练习

雷赛控制卡全方位使用指南:从硬件连接到高级应用 雷赛控制卡以其接口简单、编程便捷、性价比高的特点,成为中小自动化设备的理想选择。使用时需注意:硬件连接需注重抗干扰设计(屏蔽线、接地);软件开发需合理配置运动参数(脉冲当量、加减速);调试阶段需充分利用 DMCStudio 工具验证性能。通过本文介绍的方法,可快速实现从硬件搭建到复杂运动控制的全流程开发,满足雕刻、切割、装配等多场景的自动化需求。 阅读详情

虽然有很多题以前有做过,可这次做还是WA了好几发,有些东西看来还是没有掌握透彻。

A - A

来源:HDU1234

每天第一个到机房的人要把门打开,最后一个离开的人要把门关好。现有一堆杂乱的机房签 
到、签离记录,请根据记录找出当天开门和关门的人。 

Input

测试输入的第一行给出记录的总天数N ( > 0 )。下面列出了N天的记录。 
每天的记录在第一行给出记录的条目数M ( > 0 ),下面是M行,每行的格式为 

证件号码 签到时间 签离时间 

其中时间按“小时:分钟:秒钟”(各占2位)给出,证件号码是长度不超过15的字符串。 

Output

对每一天的记录输出1行,即当天开门和关门人的证件号码,中间用1空格分隔。 
注意:在裁判的标准测试输入中,所有记录保证完整,每个人的签到时间在签离时间之前, 
且没有多人同时签到或者签离的情况。 

Sample Input

3
1
ME3021112225321 00:00:00 23:59:59
2
EE301218 08:05:35 20:56:35
MA301134 12:35:45 21:40:42
3
CS301111 15:30:28 17:00:10
SC3021234 08:00:00 11:25:25
CS301133 21:45:00 21:58:40

Sample Output

ME3021112225321 ME3021112225321
EE301218 MA301134
SC3021234 CS301133

 思路:将时间都处理为以秒为单位的,开门人来的时间是最早的,关门人走的时间是最晚的,对于每一个人来说,都有与之对应的到达时间和离开时间。两个排序可以找到

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

struct node{
	char name[100];
	int sh,sm,ss,eh,em,es;
	int st,et;
}a[10000];
bool cmp1(node x,node y)
{
	return x.st<y.st;
}
bool cmp2(node x,node y)
{
	return x.et>y.et;
}
int main()
{
	int n,m;
	scanf("%d",&m);
	while(m--)
	{
		scanf("%d",&n);
		for(int i=0;i<n;i++)
		{
			scanf("%s %d:%d:%d %d:%d:%d",a[i].name,&a[i].sh,&a[i].sm,&a[i].ss,&a[i].eh,&a[i].em,&a[i].es);
			a[i].st=a[i].sh*3600+a[i].sm*60+a[i].ss;
			a[i].et=a[i].eh*3600+a[i].em*60+a[i].es;
		}
		sort(a,a+n,cmp1);
		printf("%s",a[0].name);
		sort(a,a+n,cmp2);
		printf(" %s\n",a[0].name);
		
	}
	return 0;
}

 


B - B

Excel可以对一组纪录按任意指定列排序。现请你编写程序实现类似功能。

Input

测试输入包含若干测试用例。每个测试用例的第1行包含两个整数 N (<=100000) 和 C,其中 N 是纪录的条数,C 是指定排序的列号。以下有 N 
行,每行包含一条学生纪录。每条学生纪录由学号(6位数字,同组测试中没有重复的学号)、姓名(不超过8位且不包含空格的字符串)、成绩(闭区间[0, 100]内的整数)组成,每个项目间用1个空格隔开。当读到 N=0 时,全部输入结束,相应的结果不要输出。 

Output

对每个测试用例,首先输出1行“Case i:”,其中 i 是测试用例的编号(从1开始)。随后在 N 行中输出按要求排序后的结果,即:当 C=1 时,按学号递增排序;当 C=2时,按姓名的非递减字典序排序;当 C=3 
时,按成绩的非递减排序。当若干学生具有相同姓名或者相同成绩时,则按他们的学号递增排序。 

Sample Input

3 1
000007 James 85
000010 Amy 90
000001 Zoe 60
4 2
000007 James 85
000010 Amy 90
000001 Zoe 60
000002 James 98
4 3
000007 James 85
000010 Amy 90
000001 Zoe 60
000002 James 90
0 0

Sample Output

Case 1:
000001 Zoe 60
000007 James 85
000010 Amy 90
Case 2:
000010 Amy 90
000002 James 98
000007 James 85
000001 Zoe 60
Case 3:
000001 Zoe 60
000007 James 85
000002 James 90
000010 Amy 90

姓名或者成绩相同的时候按学号递增排序,注意一下这点就好了

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100000+9;
struct node{
	int id,score;
	char name[10];
}a[maxn];

bool cmp1(node x,node y)
{
	return x.id<y.id;
}
bool cmp2(node x,node y)
{
	return strcmp(x.name,y.name)==0?x.id<y.id:strcmp(x.name,y.name)<0;
}
bool cmp3(node x,node y)
{
	return x.score==y.score?x.id<y.id:x.score<y.score;
}

int main()
{
	int n,c;
	int t=0;
	while(~scanf("%d %d",&n,&c)&&n)
	{
		for(int i=0;i<n;i++)
			cin>>a[i].id>>a[i].name>>a[i].score;
		switch (c)
		{
			case 1:sort(a,a+n,cmp1);break;
			case 2:sort(a,a+n,cmp2);break;
			case 3:sort(a,a+n,cmp3);break;
		}
		printf("Case %d:\n",++t);
		for(int i=0;i<n;i++)
		printf("%06d %s %d\n",a[i].id,a[i].name,a[i].score);
	}
	return 0;
}

C - C

还记得Gardon给小希布置的那个作业么?(上次比赛的1005)其实小希已经找回了原来的那张数表,现在她想确认一下她的答案是否正确,但是整个的答案是很庞大的表,小希只想让你把答案中最大的M个数告诉她就可以了。 
给定一个包含N(N<=3000)个正整数的序列,每个数不超过5000,对它们两两相加得到的N*(N-1)/2个和,求出其中前M大的数(M<=1000)并按从大到小的顺序排列。

Input

输入可能包含多组数据,其中每组数据包括两行: 
第一行两个数N和M, 
第二行N个数,表示该序列。 
 

Output

对于输入的每组数据,输出M个数,表示结果。输出应当按照从大到小的顺序排列。

Sample Input

4 4
1 2 3 4
4 5
5 3 6 4

Sample Output

7 6 5 5
11 10 9 9 8

暴力出奇迹。

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=3002;
int a[maxn];
int b[maxn*maxn];

bool cmp(int x,int y)
{
	return x>y;
}

int main()
{
	int n,m;
	while(~scanf("%d %d",&n,&m))
	{
		for(int i=0;i<n;i++)
			scanf("%d",&a[i]);
		int z=0;
		for(int i=0;i<n;i++)
			for(int j=i+1;j<n;j++)
				b[z++]=a[i]+a[j];
		sort(b,b+z,cmp);
		for(int i=0;i<m;i++)
		{
			if(i)	printf(" ");
			printf("%d",b[i]);
		}
		printf("\n");
	}
	return 0;
}

D - D

读入N名学生的成绩,将获得某一给定分数的学生人数输出。 

Input

测试输入包含若干测试用例,每个测试用例的格式为 


第1行:N 
第2行:N名学生的成绩,相邻两数字用一个空格间隔。 
第3行:给定分数 

当读到N=0时输入结束。其中N不超过1000,成绩分数为(包含)0到100之间的一个整数。 

Output

对每个测试用例,将获得给定分数的学生人数输出。 

Sample Input

3
80 60 90
60
2
85 66
0
5
60 75 90 55 75
75
0

Sample Output

1
0
2


        
  
Huge input, scanf is recommended.

数量比较小的话用桶排序比较方便

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int score[105];
int main()
{
	int n,m;	int x;
	while(~scanf("%d",&n)&&n)
	{
		memset(score,0,sizeof(score));
		for(int i=0;i<n;i++)
		{
			scanf("%d",&x);
			score[x]++;
		}
		scanf("%d",&m);
		printf("%d\n",score[m]);
	 } 
	return 0;
}

E - E

大家都知道,快速排序是不稳定的排序方法。 
如果对于数组中出现的任意a[i],a[j](i<j),其中a[i]==a[j],在进行排序以后a[i]一定出现在a[j]之前,则认为该排序是稳定的。 

某高校招生办得到一份成绩列表,上面记录了考生名字和考生成绩。并且对其使用了某排序算法按成绩进行递减排序。现在请你判断一下该排序算法是否正确,如果正确的话,则判断该排序算法是否为稳定的。 

Input

本题目包含多组输入,请处理到文件结束。 
对于每组数据,第一行有一个正整数N(0<N<300),代表成绩列表中的考生数目。 
接下来有N行,每一行有一个字符串代表考生名字(长度不超过50,仅包含'a'~'z'),和一个整数代表考生分数(小于500)。其中名字和成绩用一个空格隔开。 
再接下来又有N行,是上述列表经过某排序算法以后生成的一个序列。格式同上。

Output

对于每组数据,如果算法是正确并且稳定的,就在一行里面输出"Right"。如果算法是正确的但不是稳定的,就在一行里面输出"Not Stable",并且在下面输出正确稳定排序的列表,格式同输入。如果该算法是错误的,就在一行里面输出"Error",并且在下面输出正确稳定排序的列表,格式同输入。 

注意,本题目不考虑该排序算法是错误的,但结果是正确的这样的意外情况。

Sample Input

3
aa 10
bb 10
cc 20
cc 20
bb 10
aa 10
3
aa 10
bb 10
cc 20
cc 20
aa 10
bb 10
3
aa 10
bb 10
cc 20
aa 10
bb 10
cc 20

Sample Output

Not Stable
cc 20
aa 10
bb 10
Right
Error
cc 20
aa 10
bb 10

WA了好几次,因为没有注意题意。。。

这道题要注意如果成绩相同的话,姓名是按照输入的顺序排列的,这点比较坑

需要记录下输入顺序

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=300+9;
struct node{
	char name[55];
	int score,m;
}a[maxn];

bool cmp(node x,node y)
{
	return x.score==y.score?x.m<y.m:x.score>y.score;//成绩相同的话按照输入顺序从小到大排列 
}

int main()
{
	int n;
	node b[maxn];
	while(~scanf("%d",&n))
	{
		for(int i=0;i<n;i++)
		{
			cin>>a[i].name>>a[i].score;
			a[i].m=i;//记录输入的顺序 
		}
		for(int i=0;i<n;i++)
			cin>>b[i].name>>b[i].score;
		sort(a,a+n,cmp);
		int x=0,y=0;
		for(int i=0;i<n;i++)
			if(a[i].score!=b[i].score)
			{
				y=1;//Error
				break;
			 } 
		for(int i=0;i<n;i++)
			if(strcmp(a[i].name,b[i].name)!=0)	
			{
				x=1;//Not Stable
				break;
			}
		if(x==0&&y==0)	
		{
			printf("Right\n");
			continue;
		}
		if(y==1)
		{
			printf("Error\n");
			for(int i=0;i<n;i++)
				printf("%s %d\n",a[i].name,a[i].score);
			continue;
		}
		if(x==1)
		{
			printf("Not Stable\n");
			for(int i=0;i<n;i++)
				printf("%s %d\n",a[i].name,a[i].score);
		}
	}
	return 0;
}

F - F

“Point, point, life of student!” 
This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in this course. 
There are 5 problems in this final exam. And I will give you 100 points if you can solve all 5 problems; of course, it is fairly difficulty for many of you. If you can solve 4 problems, you can also get a high score 95 or 90 (you can get the former(前者) only when your rank is in the first half of all students who solve 4 problems). Analogically(以此类推), you can get 85、80、75、70、65、60. But you will not pass this exam if you solve nothing problem, and I will mark your score with 50. 
Note, only 1 student will get the score 95 when 3 students have solved 4 problems. 
I wish you all can pass the exam! 
Come on! 

Input

Input contains multiple test cases. Each test case contains an integer N (1<=N<=100, the number of students) in a line first, and then N lines follow. Each line contains P (0<=P<=5 number of problems that have been solved) and T(consumed time). You can assume that all data are different when 0<p. 
A test case starting with a negative integer terminates the input and this test case should not to be processed. 

Output

Output the scores of N students in N lines for each case, and there is a blank line after each case. 

Sample Input

4
5 06:30:17
4 07:31:27
4 08:12:12
4 05:23:13
1
5 06:30:17
-1

Sample Output

100
90
90
95

100

有五道题,全做对得100分,做对0道得50(交白卷还给分?)

做对4道可以得95 or90

做对3道可以得85 or80

做对2道可以得75 or70

做对1道可以得65 or60

 

在做对相同题目的人中,排名靠前的一半比排名靠后的多得5分(注意,3个人都做对4道题的话只有一个人能够得到95分)

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

struct node{
	int score,problems,num,t,h,m,s;
}a[105];

bool cmp1(node x,node y)
{
	return x.problems==y.problems?x.t<y.t:x.problems<y.problems;//按成绩从大到小排列,成绩相同按做题时间从小到大排列 
}
bool cmp2(node x,node y)
{
	return x.num<y.num;
}
int main()
{
	int n;
	while(~scanf("%d",&n)&&(n>0))
	{
		for(int i=0;i<n;i++)
		{
			scanf("%d %d:%d:%d",&a[i].problems,&a[i].h,&a[i].m,&a[i].s);
			a[i].num=i;
			a[i].t=3600*a[i].h+60*a[i].m+a[i].s;
			if(a[i].problems==5)	a[i].score=100;
			if(a[i].problems==0)	a[i].score=50;
		}
		sort(a,a+n,cmp1);
		int two=0;
		int three=0;
		int four=0;
		int one=0;
		for(int i=0;i<n;i++)
		{
			if(a[i].problems==4) four++;
			if(a[i].problems==3) three++;
			if(a[i].problems==2) two++;
			if(a[i].problems==1) one++;
		}
//		printf("\n\nfour:%d\n\n",four);
		int z=four/2;
		int k=0;
		for(int i=0;i<n;i++)
		{
			if(a[i].problems==4)
			{
				if(k<z)	a[i].score=95;
				else		a[i].score=90;
				k++;
			}
		}
	 	z=three/2;
		k=0;
		for(int i=0;i<n;i++)
		{
			if(a[i].problems==3)
			{
				if(k<z)	a[i].score=85;
				else		a[i].score=80;
				k++;
			}
		}
		z=two/2;
		k=0;
		for(int i=0;i<n;i++)
		{
			if(a[i].problems==2)
			{
				if(k<z)	a[i].score=75;
				else		a[i].score=70;
				k++;
			}
		}
		z=one/2;
		k=0;
		for(int i=0;i<n;i++)
		{
			if(a[i].problems==1)
			{
				if(k<z)	a[i].score=65;
				else		a[i].score=60;
				k++;
			}
		}
		sort(a,a+n,cmp2);
		for(int i=0;i<n;i++)
			printf("%d\n",a[i].score);
		printf("\n");
	}
	return 0;
}

 

这里是很久之前的代码,思路基本是一样的:

#include<stdio.h> 
#include<string.h>
#include<algorithm>
using namespace std;
struct node{
    int t,h,m,s;
    int first;
    int grade,score;
}a[101];
int cmp1(node x,node y)
{
    return x.grade!=y.grade?x.grade>y.grade:x.t<y.t;
}
int cmp2(node x,node y)
{
    return x.first<y.first;
}
int main() 
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        if(n<0)    break;
        for(int i=0;i<n;i++)
        {
            scanf("%d %d:%d:%d",&a[i].grade,&a[i].h,&a[i].m,&a[i].s);
            a[i].first=i;
            a[i].t=a[i].h*3600+a[i].m*60+a[i].s;
        }
        sort(a,a+n,cmp1);
        int g1=0,g2=0,g3=0,g4=0,c1,c2,c3,c4;
        for(int i=0;i<n;i++)
        {
            if(a[i].grade==5)    a[i].score=100;
            if(a[i].grade==4)    g4++; 
            if(a[i].grade==3)    g3++;
            if(a[i].grade==2)    g2++;
            if(a[i].grade==1)    g1++;
            if(a[i].grade==0)    a[i].score=50;
        }
        c4=g4/2;c3=g3/2;c2=g2/2;c1=g1/2;
        for(int i=0;i<n;i++)
        {
            if(c4>0&&a[i].grade==4)        {a[i].score=95;c4--;}    
            else if(a[i].grade==4)        a[i].score=90;
            if(c3>0&&a[i].grade==3)        {c3--;a[i].score=85;}    
            else if(a[i].grade==3)        a[i].score=80;
            if(c2>0&&a[i].grade==2)        {c2--;a[i].score=75;}    
            else if(a[i].grade==2)        a[i].score=70;
            if(c1>0&&a[i].grade==1)        {c1--;a[i].score=65;}    
            else if(a[i].grade==1)        a[i].score=60;
        }
        sort(a,a+n,cmp2);
        for(int i=0;i<n;i++)
        printf("%d\n",a[i].score);
        printf("\n");
    }
    return 0;
}

 


G - G

Limak is a little polar bear. He has n balls, the i-th ball has size ti.

Limak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey to make friends happy:

  • No two friends can get balls of the same size.
  • No two friends can get balls of sizes that differ by more than 2.

For example, Limak can choose balls with sizes 4, 5 and 3, or balls with sizes 90, 91 and 92. But he can't choose balls with sizes 5, 5 and 6 (two friends would get balls of the same size), and he can't choose balls with sizes 30, 31 and 33 (because sizes 30 and 33 differ by more than 2).

Your task is to check whether Limak can choose three balls that satisfy conditions above.

Input

The first line of the input contains one integer n (3 ≤ n ≤ 50) — the number of balls Limak has.

The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 1000) where ti denotes the size of the i-th ball.

Output

Print "YES" (without quotes) if Limak can choose three balls of distinct sizes, such that any two of them differ by no more than 2. Otherwise, print "NO" (without quotes).

Examples

Input

4
18 55 16 17

Output

YES

Input

6
40 41 43 44 44 44

Output

NO

Input

8
5 972 3 4 1 4 970 971

Output

YES

Note

In the first sample, there are 4 balls and Limak is able to choose three of them to satisfy the rules. He must must choose balls with sizes 18, 16 and 17.

In the second sample, there is no way to give gifts to three friends without breaking the rules.

In the third sample, there is even more than one way to choose balls:

  1. Choose balls with sizes 3, 4 and 5.
  2. Choose balls with sizes 972, 970, 971.

思路:存在三个连续的数就输出YES否则NO

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;

int a[1005];
int main()
{
	int n;
	while(~scanf("%d",&n))
	{
		int x;
		int k=0;
		memset(a,0,sizeof(a));
		for(int i=0;i<n;i++)
		{
			scanf("%d",&x);
			a[x]++;
		}
		for(int i=1;i<1004;i++)
			if(a[i]&&a[i+1]&&a[i+2])	
			{
				k=1;
				break;
			}
		if(k)	printf("YES\n");
		else	printf("NO\n");	
	}
	return 0;
}

 


H - H

“今年暑假不AC?” 
“是的。” 
“那你干什么呢?” 
“看世界杯呀,笨蛋!” 
“@#$%^&*%...” 

确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会抛开电脑,奔向电视了。 
作为球迷,一定想看尽量多的完整的比赛,当然,作为新时代的好青年,你一定还会看一些其它的节目,比如新闻联播(永远不要忘记关心国家大事)、非常6+7、超级女生,以及王小丫的《开心辞典》等等,假设你已经知道了所有你喜欢看的电视节目的转播时间表,你会合理安排吗?(目标是能看尽量多的完整节目) 

Input

输入数据包含多个测试实例,每个测试实例的第一行只有一个整数n(n<=100),表示你喜欢看的节目的总数,然后是n行数据,每行包括两个数据Ti_s,Ti_e (1<=i<=n),分别表示第i个节目的开始和结束时间,为了简化问题,每个时间都用一个正整数表示。n=0表示输入结束,不做处理。 

Output

对于每个测试实例,输出能完整看到的电视节目的个数,每个测试实例的输出占一行。

Sample Input

12
1 3
3 4
0 7
3 8
15 19
15 20
10 15
8 18
6 12
5 10
4 14
2 9
0

Sample Output

5

 

活动安排问题的模板题,按照结束时间早的顺序排序

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

struct node{
	int st,et;
}a[105]; 

bool cmp(node x,node y)
{
	return x.et<y.et;
}

int main()
{
	int n;
	while(~scanf("%d",&n)&&n)
	{
		for(int i=0;i<n;i++)
			cin>>a[i].st>>a[i].et;
		sort(a,a+n,cmp);
		int z=a[0].et;
		int ans=1;
		for(int i=1;i<n;i++)
			if(a[i].st>=z)
			{
				ans++;
				z=a[i].et;
			}
		cout<<ans<<endl;
	}
	return 0;
}

       

【YOLOv11】087、YOLOv11多任务学习:检测、分割、分类联合学习 摘要: 工业质检场景中,多任务模型(检测、分类、分割)的需求日益增长。针对边缘设备部署的挑战,本文提出基于YOLOv11的多任务学习方案。通过共享主干网络和设计分支头(检测、分割、分类),实现高效推理;采用动态权重平衡策略解决多任务损失不平衡问题;并优化数据流处理(支持部分标注)和推理剪裁(按需启用分支)。实验表明,该方法在Jetson Orin上帧率提升3倍,内存占用减少40%,为工业质检提供了轻量高效的解决方案。 阅读详情

相关推荐

【车辆动力学】专栏目录汇总

车辆动力学知识目录汇总

CrazyRabbit的博客 1713

Element表格---使用sort-method实现的几种排序

html部分 :sort-method="sortNumber" //html部分 <el-table-column sortable :sort-method="sortNumber" label="金额" prop="total" /> js部分 methods:{ sortMethod(a, b) { return a.total - b.total } }

pei_y_y的博客 5577

医学图像中的小目标病灶检测难题:我的硕士研究总结与思考

医学图像中的小目标检测和分割,主要指在CT、MRI、超声等医学影像中识别和分割微小病灶或细小结构。这些小目标通常体积小、边界模糊、特征不明显,却往往是关键病灶,例如肺部小结节、脑微出血、乳腺微钙化等。

weixin_45638136的博客 2370

HDU——1084 What is your grade?(莫名的Wrong Answer)

Problem Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the...

LightOn 378

别再套用星形公式了!三角形接法PMSM的FOC控制,扇区判断与作用时间推导全解析

本文深入解析三角形接法永磁同步电机(PMSM)的FOC控制技术,重点探讨30度相位差对SVPWM扇区判断与电压矢量作用时间的影响。通过数学推导与实验验证,详细讲解修正后的扇区划分规则、作用时间计算公式优化方法,并提供可直接移植到STM32的代码实现,帮助工程师解决三角形接法特有的相电流重构与同步采样难题。

weixin_30689307的博客 469

歪枣网股票数据下载接口汇总一

歪枣网上下载接口动态信息如下: 接口名称:A股列表,接口描述:沪深京A股基本信息,接口地址:/doc/getStockHSABaseInfo?code=all&fields=code,name,stype,hsgt,bk,roe,zgb,ltgb&export=0&token= 请求参数描述: 参数名:code,参数描述:股票代码,支持批量查询,用逗号分隔,每次最多30个;若为all,则表示全部,即可获取任意一天内的所有数据。 请求参数描述: 参数名:fields,参数描述:数据字段

waizaowang的博客 2731

"巴卡斯杯" 中国大学生程序设计竞赛 - 女生专场(重现)解题思路

"巴卡斯杯" 中国大学生程序设计竞赛 - 女生专场(重现)解题思路

queuelovestack的专栏 1万+

IMU数据处理避坑指南:从理论到实践的加速度计重力消除方案

本文详细解析了IMU数据处理中的重力消除技术,从理论基础到实践应用,涵盖了加速度计和陀螺仪的核心问题。通过ROS2实战案例,介绍了静态标定与动态校准的技术对比,以及多传感器融合的进阶策略,帮助开发者避免常见陷阱,提升IMU数据处理的精度和效率。

purple的博客 741

HDOJ1872(稳定排序)

稳定排序 Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1066Accepted Submission(s): 408 Problem Description 大家都知道,快速排序是不稳定的排序方法。 如果对于...

weixin_30402085的博客 491

保姆级教程:在Davinci Configurator里配置BswM的ECU状态机(附状态切换流程图)

本文提供了一份详细的AUTOSAR BswM模块配置指南,通过Davinci Configurator工具实现ECU状态机的构建与管理。内容涵盖从模式请求端口创建到状态切换规则定义的全流程,特别针对Ecu State Handling进行了深入解析,并附有状态切换流程图,帮助汽车电子工程师高效完成ECU状态管理配置。

weixin_28366475的博客 411

从零构建生产级K8s-v1.35.0集群:基于Containerd与Cilium的kubeadm实战指南

本文详细介绍了从零构建生产级K8s-v1.35.0集群的全过程,涵盖环境准备、Containerd配置、Kubernetes组件安装、集群初始化及Cilium网络部署等关键步骤。通过实战经验分享系统调优技巧和常见问题解决方案,帮助读者快速搭建稳定高效的Kubernetes集群。

weixin_28725553的博客 219

sort函数的第三个参数cmp

sort 函数的第三个参数 cmp

风暴计划 6730

STM32F407驱动OV2640摄像头全栈解析:DCMI+DMA+SCCB协同设计

图像采集是嵌入式视觉系统的基石,其核心在于传感器与MCU间的数据通路构建。原理上需理解并行接口(如DCMI)的硬件同步捕获机制、串行控制总线(如SCCB/I²C)的寄存器级配置逻辑,以及DMA在高吞吐数据搬运中的关键作用。技术价值体现在解放CPU、保障实时性、降低功耗,并支撑JPEG压缩与RGB565直显等差异化应用。典型场景包括智能终端实时预览、低带宽图像上传、工业现场视频监控及教学实验平台搭建。本文以STM32F407与OV2640集成实践为载体,深入剖析DCMI时序约束、SCCB软件模拟实现及DMA循

weixin_36151775的博客 180

暑假算法集训(第一周)

算法暑期训练

qq_56356279的博客 1059

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

2019年暑假集训第十一套题

问题 A: 排名 题目描述 在ACM竞赛中,当遇到有两个队伍(人) 解出相同的题目数量的时候,我们需要通过他们解决问题的总时间进行排序。 一共有 N(1<=N<=5,000)条时间被以时(0<=Hours<=99), 分(0<=Minutes<=59),秒(0<=Seconds<=59)的形式记录。 你必须要把他们按时,分,秒排序为 升序,最少的...

算法小猪的博客 774

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

2019暑假集训第二周tips

1 用reverse() 函数时要加算法头文件 #include<algorithm> 或者直接万能头文件 #include"bits/stdc++.h" 2 sort() 函数排序的范围是 [ first, last ),包括 first,不包括 last sort() 可以用自定义的比较函数进行排 序,也可以用系统的4种排序:less、greater、 less_equal(小...

qq_40409416的博客 187

ACM暑假集训_STL&模拟_B-Where is the Marble?

ACM暑假集训_STL&amp;模拟_B-Where is the Marble? Description Raju and Meena love to play with Marbles. They have got a lot of marbles with numbers written on them. At the beginning, Raju would place the m...

油爆虾的博客 410

ACM暑假培训第二周学习总结----出自南昌理工学院ACM集训队

1.vector与数组的区别 vector是c++标准库中bai定义的类型,是容器du的一种。标准库中容器有很多种,vector只是最基本的一种,vector类型和数组类型的基本功能都是一样的,就是存储同类元素,但是他与数组最大的区别就是可以实现动态存储。 vector相当于动态数组,比如 char str[100];只能存储100个字符。vector可以动态增长。 vector str(10,‘A’); //初始化为zhi包含10个’A’字符的数组 str.push_back(‘B’); // 现在dao

小世儿的博客 341

2021暑假集训-个人赛11

文章目录A.Simply Strange SortB.Charmed by the Game *C.Deep Down BelowD.Up the Strip (simplified version) *E.Up the Strip *F.Bottom-Tier Reversals *G.Top-Notch Insertions * A.Simply Strange Sort 传送门 题目大意:有两种操作,一种是偶数只对偶数和他后面的进行判断,如果前面大,前后就进行交换 ,同理奇数也是这样,奇数跟偶数..

xingzi201的博客 422

暑假集训 8.16 数据结构实验之排序三:bucket sort (简单的桶排序)

数据结构实验之排序三:bucket sort Time Limit: 100ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 根据人口普查结果,知道目前淄博市大约500万人口,你的任务是帮助人口普查办公室按年龄递增的顺序输出每个年龄有多少人,其中不满1周岁的按0岁计算,1到2周岁的按1岁计算,依次类推,大于等于100岁的

Welcome ! This is Guanpx's blog. 423

2016HUAS_ACM暑假集训2G - Who's in the Middle

这个题真的没什么好说的。一个排序就能解决的问题。唯一感到不爽的是这道题不是0msAC的,希望各位大神能够给我点指导。 头文件#include<algorithm>,注意一下排序函数的用法就行了。 我在HDU和POJ上测试了很多次,不得不说HDU确实比较坑爹。POJ上一组案例也是可以过的,当然,这不重要。 题意也简单,大致就是给一组数字要你求中位数。而且给的是奇数个数字。...

dianluoxi8545的博客 138

输出前m个最大数(北京大学暑假集训 )

描述 给定一个数组包含n个元素,统计前m大的数并且把这m个数从大到小输 出。 Input 第一行包含一个整数n和一个整数m。m &lt; n。n表示数组的大小,n &lt; 100000,m表示前m位最大的数。 第二行包含n个整数,表示数组的元素,整数之间以一个空格分开 。每个整数的绝对值不超过100000000。 第三行 output 从大到小输出前m大的数 #in...

weixin_42826497的博客 271

[补题]暑假集训day1_Andrew Stankevich Contest 37

一共9道题,做出4道题,其中我写了两道 A. Achromatic Number n个点的环,给每个点染色使得相邻点颜色不同且所有[Math Processing Error]Ck2C_k^2种颜色相邻都出现过 B. Binary Search C. Blind Flibs D. Bubble Sort E. Word Cover F. Permutations with Monot...

秋叶红于二月花 556

【每日一记·2019.7.17】

2019.7.17(361/119) 记录每天自己的新的感受体会亦或者是题目中的坑。 概述 1.暑假集训第七天。今天中午差点迟到。都到2点20了才醒…惊悚… 2.早上背了复习了前面六天的NewwordsNew wordsNewwords。背了23个新单词。 3.今天把分块看了下。把分块入门一二三四AC了。然后见了一些其他的线段树模型。 题目: 【分块】 其实,大部分的分块都可以用其他的数据结构来代...

EPSILON的博客 255

AtCoder Beginner Contest 254

AtCoder Beginner Contest 254

青少年趣味编程 765

3326:练55.1 合影效果

3326:练55.1 合影效果

青少年趣味编程 520

结合poj 2104,对于简单的归并树谈谈个人的理解和做法

题目:poj 2104 大意:给你一个长度为n的数列,每次查询数列下标为[i,j]区间里面升序排序后第k大的数 (我刚刚加入学校集训队暑假acm集训的时候遇到这题直接头铁sort。。。。现在想起来还真是天真) 由此引出归并树(其实这一题用主席树更快,点击传送!) 首先,区间升序排序第k大需要做一个小小的转换,不妨设那个数就是aim,就是区间内比aim小的&lt;k个,小于等于aim的&gt...

forOnward的博客 306
上一篇: 2018年HPUACM暑期集训招新赛
下一篇: Bone Collector(01背包问题)
陶鸿杰
博客等级 码龄9年 93粉丝 298原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值