- 博客(47)
- 收藏
- 关注
原创 LeetCode SQL刷题笔记DAY2
1. 题1873if(employee_id % 2 = 1,(if(name like 'M%',0,salary)),0) AS bonusname like 'M%' 可用 left(name,1)2. 题627update salary set sex = if(sex = 'm','f','m')3. 题196delete from Person where Id not in ( select * from( select min(Id)
2022-05-01 19:38:22 232
原创 LeetCode SQL刷题笔记DAY3
1. 题1448GROUP_CONCAT(DISTINCT PRODUCT) AS products多列压缩select sell_date,count(distinct product) AS num_sold,GROUP_CONCAT(DISTINCT PRODUCT) AS productsfrom Activitiesgroup by sell_date输入:Activities 表:+------------+-------------+| sell_date | prod
2022-05-01 19:32:33 338
原创 JAVA 仿射密码输入密文解出明文
只做到了e不变的情况package practice1;import java.util.Scanner;public class Hello { public static void main(String[] args) { Scanner input = new Scanner(System.in); String str1 = input.nextLine(); int[] count = new int[26];
2021-09-22 17:17:19 749
原创 记录——python编程从入门到实践十二章练习题
12-1、12-2、12-3main.pyimport sysimport pygamefrom homura import Hofrom sets import Settingsimport game_function as gfdef run_game(): pygame.init() ai_settings = Settings() screen = pygame.display.set_mode((ai_settings.screen_width,ai_s
2021-05-10 18:48:34 233
原创 leetcode二叉树最大深度和最小深度
最大深度int maxDepth(struct TreeNode* root){ int HL,HR,MaxH; if(root){ HL=maxDepth(root->left); HR=maxDepth(root->right); MaxH=(HL>HR)?HL:HR; return (MaxH+1); } else return 0;}最小深度(乌鱼
2020-05-21 16:51:31 225
原创 PTAMaximum Subsequence Sum24分C++
#include <iostream>#include<cstring>#include<stdio.h>#include<string.h>using namespace std;int main(){ int n;cin >>n; int a[n]; int i=0,j=0,t=0,m=0,p=0,q=0,y=0,l...
2020-05-06 19:40:17 139
原创 leetcode21. 合并两个有序链表C
和PTA差不多struct ListNode* mergeTwoLists(struct ListNode* l1, struct ListNode* l2){ if(l1==NULL) return l2; if(l2==NULL) return l1; struct ListNode *l3; l3 = (struct ListNode*)malloc(siz...
2020-05-05 13:52:05 148
原创 leetcode面试题 02.02. 返回倒数第 k 个节点C
int kthToLast(struct ListNode* head, int k){ struct ListNode *p=head; int i=0; while(p!=NULL){ p=p->next; i++; } k=i-k;i=0; p=head; while(p...
2020-05-05 13:26:17 182
原创 leetcode面试题 02.03. 删除中间节点C
void deleteNode(struct ListNode* node) { node->val = node->next->val; node->next = node->next->next;}
2020-05-05 13:21:51 184
原创 LeetCode141环形链表C语言
1.双指针bool hasCycle(struct ListNode *head) { if(head==NULL)return false; struct ListNode *p=head; struct ListNode *q=head->next; while(q!=p){ if(q==NULL||q->next==NULL)...
2020-05-04 14:44:58 228
原创 PTA两个有序链表序列的合并
List Merge( List L1, List L2 ){ if(L1 == NULL || L2 == NULL) return NULL; List L3 = (List)malloc(sizeof(struct Node));//分配空间 if(L3 == NULL) return NULL; List p=L3; Lis...
2020-05-01 16:12:00 307
原创 PTA二分查找
Position BinarySearch( List L, ElementType X ){ int LE=1,R=L->Last; while(LE<=R){ int mid=LE+(R-LE)/2; if(X>L->Data[mid]) LE=mid+1; else if(X<L...
2020-05-01 15:01:49 969
原创 noi特殊密码锁(只有6分)需改进
估计没贪心#include <iostream>#include<cstring>#include<stdio.h>#include<math.h>#include<cmath>#include<string.h>#include<algorithm>using namespace std;int...
2020-04-27 18:01:09 270
原创 noi7600最长最短单词(7分)
不知道哪里错了#include<iostream>#include<string>#include<cstring>#include<string.h>#include<stdio.h>using namespace std;int main(){ char a[20000];char x[100],y[100];int ...
2020-04-22 16:19:06 221
原创 noi最大公约数
递归#include <stdio.h>#include <iostream>#include <string.h>#include <math.h>using namespace std;int shu(int a,int b){ if(a%b==0) return b; return shu(b,a%b...
2020-04-21 16:12:01 230
原创 noiPell数列
1递归#include <stdio.h>#include <iostream>#include <string.h>#include <math.h>using namespace std;int pell(int a){ if(a==2) return 2; if(a==1) retur...
2020-04-21 15:57:40 202
原创 noi校门外的树
#include <stdio.h>#include <iostream>#include <string.h>#include <math.h>using namespace std;int main(){ int l,m,p=0;int x,y;cin >>l>>m; int a[l+1]={0}...
2020-04-21 15:25:40 225
原创 noi雇佣兵
#include <stdio.h>#include <iostream>#include <string.h>using namespace std;int main(){ int m,n,x,p; cin >>m>>n>>x; while(x>0){ p=m/n; ...
2020-04-21 14:36:46 210
原创 noi买房子
#include <stdio.h>#include <iostream>#include <string.h>#include <math.h>using namespace std;int main(){ int n,k,y=1;double l,p; cin >>n>>k; l=200;...
2020-04-21 13:48:03 498
原创 游戏——简陋的飞机游戏and一堆bug
#include <iostream>#include<stdlib.h>#include<stdio.h>#include<conio.h>#include<windows.h> using namespace std; #define high 15#define width 25 in...
2020-03-10 18:22:16 355
原创 排序——插入排序
int charupaixu(int *a){ for(int j=1;j<10;j++){ int i,k=a[j]; i=j-1; while(i>=0&&a[i]>k){ a[i+1]=a[i]; i--; } a[i+1]=k...
2020-03-10 18:04:39 129
原创 排序——选择排序
int xuanzepaixu(int *a){ int mi,t,b; for(int i=0;i<10;i++){ //数组长度 mi=1000;//其实应该用int最大数 for(int j=i;j<10;j++){ if(a[j]<mi){ mi=a[j]; ...
2020-03-10 18:03:20 127 1
原创 PTA1023 组个最小数
#include<iostream>#include<stdio.h>#include<stdlib.h>using namespace std;int main(){ int a[10]; for(int i=0;i<10;i++) cin >>a[i]; fo...
2020-03-10 13:22:56 199
原创 noi第n小的质数
#include<iostream>#include<cstring>#include<stdio.h>#include<math.h>using namespace std;int main(){ int n,j,i=-1;bool p=0; cin >>n; for(j=1;;p=0,j++){ ...
2020-02-24 16:21:28 278
原创 noi 合影效果
#include<iostream>#include<cstring>#include<stdio.h>#include<algorithm>using namespace std;struct people{ char xi[7]; float cm;};bool cmp(float a,float b){...
2020-02-24 14:24:36 264
原创 noi分数线划定
#include<iostream>#include<cstring>#include<stdio.h>#include<algorithm>using namespace std;struct baoming{ int haoma; int s;};bool cmp(baoming a,baoming b){ ...
2020-02-23 21:40:25 413
原创 noi成绩排序C++
#include<iostream>#include<cstring>#include<stdio.h>#include<algorithm>using namespace std;struct xuesheng{ char xuexiao[20];//懒得改成name int chengji;};int x,y;bo...
2020-02-23 20:35:02 410
原创 noi谁考了第k名C++
#include<iostream>#include<cstring>#include<stdio.h>#include<algorithm>using namespace std;struct xuesheng{ int xuexiao; float chengji;};//可以在这一排直接定义bool cmp(xue...
2020-02-23 20:14:08 779
原创 noi输出最高分学生的姓名
#include<iostream>#include<cstring>#include<stdio.h>using namespace std;int main(){ int n,a,m=0; scanf("%d",&n); char b[23];char c[23]; while(n){ scanf("%d",&...
2020-02-22 14:34:47 228
原创 noi金币
#include<iostream>#include<string>#include<cstring>#include<string.h>#include<stdio.h>using namespace std;int main(){ int n,i=1,s=0; cin >>n; whil...
2020-02-15 17:12:18 262
原创 noi基因相关性
#include<iostream>#include<string>#include<cstring>#include<string.h>#include<stdio.h>using namespace std;int main(){ int k=0;double m,p=0.0; cin >>m; ...
2020-02-12 17:03:44 243
原创 noi找第一个只出现一次的字符
描述给定一个只包含小写字母的字符串,请你找到第一个仅出现一次的字符。如果没有,输出no。 输入一个字符串,长度小于100000。输出输出第一个仅出现一次的字符,若没有则输出no。考虑ababc,abcab,ababcc,ababcd,abcdab#include<iostream>#include<string>#include<cs...
2020-02-12 16:44:18 306
原创 noi合法C标识符
#include<iostream>#include<cstring>#include<stdio.h>using namespace std;int main(){ char a[20];int k=0;bool p=0; gets(a); int n;n=strlen(a); for(int i=0;i<n;i++){...
2020-02-08 17:10:51 322
原创 noi一元二次方程的根
#include<iostream>#include<iomanip>#include<cmath>using namespace std;int main(){ double a,b,c,n,m,x1,x2,i,j; cin >>a>>b>>c; n=b*b;m=4*a*c; x1=...
2020-02-08 14:38:48 350
原创 noi图像顺时针旋转90
#include <iostream>#include <iomanip>#include <cstdio>#include<stdio.h>using namespace std;const int MX = 110;short a[MX][MX];short b[MX][MX];int main(){ int n,m; sc...
2020-02-06 15:33:29 194
原创 noi矩形转置
#include <iostream>#include <iomanip>#include <cstdio>#include<stdio.h>using namespace std;const int MX = 110;short a[MX][MX];short b[MX][MX];int main(){ int n,m; sc...
2020-02-06 15:15:52 274
原创 noi计算鞍点(不知道哪里有问题)
#include<iostream>#include<cmath>using namespace std;int main(){ int a[5][5]; for(int i=0;i<5;i++) for(int j=0;j<5;j++) cin >>a[i][j]; int ma=0,m,...
2020-02-05 16:30:07 188
原创 noi有趣的跳跃
(一点都不有趣)#include<iostream>#include<cmath>using namespace std;int main(){ int n; cin >>n; int a[n]; for (int i=0;i<n;i++) cin >>a[i]; if(n>2){ ...
2020-02-03 17:10:47 753
原创 noi石头剪刀布
#include<iostream>#include<cmath>using namespace std;int main(){ int n,m,p; int A=0,B=0; cin >>p>>n>>m; int a[n],b[m]; for (int i=0;i<n;i++) c...
2020-02-03 16:50:45 563
原创 noi正常血压
#include<iostream>using namespace std;int main(){ int x,a,b,n=0,t=0; cin >>x; while(x--){ cin >>a>>b; if(a<=140&&a>=90&&b>=60&...
2020-02-02 14:58:29 332
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人