摘要: 题解:递归方法,在上一题的题解上面加一个限定就行了 点击查看代码 #include<iostream> #include<algorithm> #include<cstring> using namespace std; typedef pair<int,int> pll; typedef long 阅读全文
posted @ 2023-02-16 18:41 xxj112 阅读(48) 评论(0) 推荐(0)
摘要: 题解:递归,加数组 点击查看代码 #include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N=1e5+7; int n; int a[N]; void dfs(int x,int 阅读全文
posted @ 2023-02-16 17:07 xxj112 阅读(15) 评论(0) 推荐(0)
摘要: 算法:动态规划位操作压缩 题解:e[i][j] i表示路线 ,j表示终点 ,初始化e[1][0]=0,表示从0点出发。 例如:i=7,n=4,二进制为 0111 表示经过 点 0 1 2 。 点击查看代码 #include<iostream> #include<algorithm> #include 阅读全文
posted @ 2023-02-16 16:56 xxj112 阅读(11) 评论(0) 推荐(0)
摘要: 算法:二分加前缀和 题解:二分查找最大平均值,f函数判断当前平均值mid是否合适,数组元素减去x,求前缀和sum,从sum[k]遍历,mi中存前面的最小值。 点击查看代码 #include<iostream> #include<algorithm> using namespace std; cons 阅读全文
posted @ 2023-02-15 20:21 xxj112 阅读(30) 评论(0) 推荐(0)
摘要: 点击查看代码 int a,b,c,d; cin>>a>>b>>c>>d; int ans=0; if(a>=0&&c<=0||c>=0&&a<=0) ans++; //x轴交点 if(b>=0&&d<=0||b>=0&&d<=0) ans++; //y轴交点 if(ans==2&&a*d==b*c) 阅读全文
posted @ 2023-02-14 21:17 xxj112 阅读(30) 评论(0) 推荐(0)
摘要: 点击查看代码 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6 + 10; ll a,b,p; ll solve() { ll ans=0; while(b) { if(b&1) 阅读全文
posted @ 2023-02-13 19:39 xxj112 阅读(17) 评论(0) 推荐(0)
摘要: 点击查看代码 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6 + 10; ll a,b,p; ll solve() { ll ans=1; while(b) { if(b&1) 阅读全文
posted @ 2023-02-13 19:26 xxj112 阅读(13) 评论(0) 推荐(0)
摘要: 这题主要是广搜寻找匹配值。 但是重复的结果比较多,可以用map或者set去重。unordered_map更快。 搜索题,可以先看下所有可能的大小,如果不大,可以选择适当方法标记下,重复则直接跳过。 阅读全文
posted @ 2022-10-10 20:22 xxj112 阅读(24) 评论(0) 推荐(0)
摘要: #pragma once #include<graphics.h> void drawAlpha(IMAGE* picture, int picture_x, int picture_y) //x为载入图片的X坐标,y为Y坐标 { // 变量初始化 DWORD* dst = GetImageBuff 阅读全文
posted @ 2022-06-30 20:21 xxj112 阅读(56) 评论(0) 推荐(0)
摘要: 修改了速度不稳定的bug, 取消手动输入, 用方向键和回车控制, 新增蛇体颜色选择和障碍物选项, 更加接近成品游戏, 画面更加美观。 上代码: 不是程序员的小朋友,可以私聊我,要程序。(3073309211) #include <stdio.h> #include <Windows.h> #incl 阅读全文
posted @ 2022-05-25 13:12 xxj112 阅读(93) 评论(0) 推荐(0)