摘要: public int[] reversePrint(ListNode head) { Stack<ListNode> stack = new Stack<>(); ListNode temp = head; while(temp != null){ stack.push(temp); temp = 阅读全文
posted @ 2020-04-10 11:13 贱人郭 阅读(126) 评论(0) 推荐(0) 编辑
摘要: //直接用HashSet 简单使用:https://blog.csdn.net/diaobao_weixiao/article/details/52784947 //HashMap的遍历:https://www.cnblogs.com/meieiem/archive/2011/11/02/22330 阅读全文
posted @ 2020-04-09 22:37 贱人郭 阅读(133) 评论(0) 推荐(0) 编辑
摘要: public class Main { static boolean judge(int[] arr, int start, int end){ if (start >= end) return true; int i = end; int root = arr[end]; //i的位置是第一个大于 阅读全文
posted @ 2020-04-08 21:41 贱人郭 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 今天是第一次用Java提交PAT的代码: 源代码不能直接提交,需要经过修改: 源代码: 阅读全文
posted @ 2017-05-06 21:07 贱人郭 阅读(105) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; struct student { char num[10]; char name[10]; int grade; }s[100002]; int cmp1(student s1,student s2)//case 1 按照学号递增 { return strcmp(s... 阅读全文
posted @ 2017-03-15 18:18 贱人郭 阅读(160) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; struct string { char str[210]; }s[210]; void toLow(char c[]) { int len=strlen(c); for(int j=0;j='A' && c[j]<='Z') c[j]=c[j]-'... 阅读全文
posted @ 2017-03-15 17:25 贱人郭 阅读(202) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; struct string { char str[1005]; int len; }s[10000]; int main() { int k=0; int max=0,min=1001; while(scanf("%s",s[k].str)!=EOF) {... 阅读全文
posted @ 2017-03-15 16:31 贱人郭 阅读(181) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<stdlib.h>#include<string.h> using namespace std; struct string{ int len; char str[1005];}; int cmp(const void *str1,const vo 阅读全文
posted @ 2017-03-15 15:47 贱人郭 阅读(131) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int main() { char *a=(char *)malloc(sizeof(char)); while(scanf("%s",a)!=EOF) { int len=strlen(a); sort(a,a+len); ... 阅读全文
posted @ 2017-03-15 12:51 贱人郭 阅读(142) 评论(0) 推荐(0) 编辑
摘要: sort()cmp函数容易出错; int cmp(Node a,Node b){ if (a.f!=b.f)return a.f>b.f; else { int f=strcmp(a.name,b.name);//直接写成 return a.name-b.name就错 return f<0; } } 阅读全文
posted @ 2017-03-15 12:09 贱人郭 阅读(166) 评论(0) 推荐(0) 编辑