llllmz

导航

2024年1月7日

KY2 成绩排序C++

摘要: 用C++库函数sort秒杀了,建一个结构体就好了,同时储存输入次序。 #include<iostream> #include<algorithm> #include<cstdlib> using namespace std; struct node{ int num; char x[20]; int 阅读全文

posted @ 2024-01-07 23:28 神奇的萝卜丝 阅读(29) 评论(0) 推荐(0)

经典算法题之成绩排序C

摘要: #include<stdio.h> typedef struct node{ int num; int data; }student; int divide1(student A[],int head,int tail){ if(head==tail) return head; int t=A[he 阅读全文

posted @ 2024-01-07 21:52 神奇的萝卜丝 阅读(30) 评论(0) 推荐(0)

经典算法题之-成绩排序C++

摘要: sort实在是太好用了。活用sort,一切排序题目都可以秒杀。 #include <iostream> #include <algorithm> using namespace std; struct node{ int num; int date; }; typedef struct node s 阅读全文

posted @ 2024-01-07 16:54 神奇的萝卜丝 阅读(216) 评论(0) 推荐(0)

经典算法之-整数奇偶排序C

摘要: #include <stdio.h> int divide(int A[],int head,int tail){ if(head==tail) return head; int t=A[head]; while(head<tail){ while(head<tail && A[tail]>t ) 阅读全文

posted @ 2024-01-07 11:42 神奇的萝卜丝 阅读(40) 评论(0) 推荐(0)

经典算法题之整奇偶排序C++

摘要: 建两个数组就好了,一个存奇数一个存偶数,然后sort一下,最后输出。 #include <iostream> #include <algorithm> using namespace std; bool comp(int left,int right){ if(left > right) retur 阅读全文

posted @ 2024-01-07 11:19 神奇的萝卜丝 阅读(135) 评论(0) 推荐(0)

经典算法题之排序C

摘要: 写个快排就完事了。实在不行,写个选择排序也很简单。 #include<stdio.h> int devide(int A[],int head,int tail){ if(head==tail) return head; int t = A[head] ; while(head < tail){ w 阅读全文

posted @ 2024-01-07 10:03 神奇的萝卜丝 阅读(21) 评论(0) 推荐(0)

经典算法题之排序C++

摘要: c++还是方便啊,直接调用库函数就可以实现排序了。不用自己实现排序函数了。 #include<iostream> #include<algorithm> using namespace std; int main(){ int A[101]={0}; int n = 0 ; while(cin >> 阅读全文

posted @ 2024-01-07 09:27 神奇的萝卜丝 阅读(22) 评论(0) 推荐(0)