摘要:5..#####...#.#.......##### 4 0 #include<bits/stdc++.h> using namespace std; bool flag; char a[1010][1010]; int cnt=0,ans=0,rans=0; int n; int dx[4]={1
阅读全文
摘要:#include <iostream> #include <vector> #include <cmath> #include <algorithm> using namespace std; int main() { // 请在此输入您的代码 int n; cin>>n; //块长 int len
阅读全文
摘要:错误 #include<bits/stdc++.h> using namespace std; const int N = 1e6; int isprime[1000005] = {}; int d(int t)//最小质因数 { for (int i = 1; i <= N; i++)//最大就是
阅读全文
摘要:class Solution { public: vector<int> intersect(vector<int>& nums1, vector<int>& nums2) { if (nums1.size() > nums2.size()) { return intersect(nums2, nu
阅读全文
摘要:循环超时 class Solution { public: int firstUniqChar(string s) { for(int i=0;i<s.size();i++) { bool ok=true; for(int j=0;j<s.size();j++) { if(j==i) continu
阅读全文
摘要:121. 买卖股票的最佳时机 - 力扣(LeetCode) class Solution { public: int maxProfit(vector<int>& prices) { int max=0; for(int i=0;i<prices.size();i++) for(int j=i;j<
阅读全文
摘要:有n个人排成一队散步,第二天每个人都不想和前一天前面的人相同,多少种排列 n!-(n-1)(n-1)!+(n-2)(n-2)!-...1*1 模拟n=3 #include<iostream> #include<algorithm> #include<string.h> using namespace
阅读全文
摘要:输入 第一行两个整数n,m。 接下来一个N行M列的01矩阵,数字之间没有空格。 数据范围 1≤N,M≤1000 输出 一个N行M列的矩阵B,相邻两个整数之间用一个空格隔开。每个整数表示加农势力存在的毫秒数(最小曼哈顿距离值) 输入样例 1 3 4 0001 0011 0110 输出样例 1 3 2
阅读全文
摘要:#include<iostream> #include<string.h> #include<stdio.h> #include<fstream> using namespace std; int next[10]; void Next(char*T,int n) { int i=1,j=0; ne
阅读全文
摘要:题目描述 蓝桥学院由 2121 栋教学楼组成,教学楼编号 11 到 2121。对于两栋教学楼 �a 和 �b,当 �a 和 �b 互质时,�a 和 �b 之间有一条走廊直接相连,两个方向皆可通行,否则没有直接连接的走廊。 小蓝现在在第一栋教学楼,他想要访问每栋教学楼正好一次,
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 10; int n, m, q; struct edge { int v; ll w; edge(){} edge(in
阅读全文
摘要:问题描述 给定 �T 个正整数 ��ai, 分别问每个 ��ai 能否表示为 �1�1⋅�2�2x1y1⋅x2y2 的形式, 其中 �1,�2x1,x2 为正整数, �1,�2y1,y2 为大于等于 2 的正整数。 输入格式 输入第一行包含一个整数 �T 表示洵间次数。 接下来
阅读全文
摘要:问题描述 有一根围绕原点 �O 顺时针旋转的棒 ��OA, 初始时指向正上方 (Y 轴正向)。 在平面中有若干物件, 第 �i 个物件的坐标为 (��,��)(xi,yi), 价值为 ��zi 。当棒扫到某个 物件时, 棒的长度会瞬间增长 ��zi, 且物件瞬间消失(棒的顶端恰好碰到物件也
阅读全文
摘要:问题描述 给定一个长度为 �N 的整数序列: �1,�2,⋯,��A1,A2,⋯,AN 。现在你有一次机会, 将其 中连续的 �K 个数修改成任意一个相同值。请你计算如何修改可以使修改后的数 列的最长不下降子序列最长, 请输出这个最长的长度。 最长不下降子序列是指序列中的一个子序列, 子序列中
阅读全文
摘要:100s+35t=gcd(100,35) 100和35最大公约数5 gcd(100,35)=5 #include<bits/stdc++.h> using namespace std; int extgcd(int c, int d, int&x, int&y) { int g = c; if(d)
阅读全文
摘要:https://www.lanqiao.cn/courses/1029 对汽车燃料效率建模 数据集 http://labfile.oss.aliyuncs.com/courses/1029/mpg.csv 代码 # coding: utf-8 import matplotlib.pyplot as
阅读全文
摘要:基础篇 最长增加子数组 - 楠030416 - 博客园 (cnblogs.com) 增加线段树 子串 #include<bits/stdc++.h> using namespace std; //最长连续增加子串 int a[100],dp[100],tree[100]; void build(in
阅读全文
摘要:子串 要求一定要挨着 121 2 3 4 3 2 1 4 5 6 7 8 结果 6 #include<bits/stdc++.h> using namespace std; //最长连续增加子串 int a[100],dp[100],maxn=0; int main() { int n; cin>>
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 10; const int MOD = 998244353; ll x[maxn], y[maxn]; //快速幂模板
阅读全文
摘要:每次从一开始或者最后拿,拿多的赢 #include<iostream> using namespace std; int stone[10]; int dp[10][10];//从i到j两人数量差的最大值 int main() { int n; cin>>n; for(int i=0;i<n;i++
阅读全文
摘要:每次下一个或者两个棋,你先开始下,空位n个,填满最后一个位置输 分析得到必胜必败状态 1败,2胜,3胜,4败,5胜,6胜,7败... 只剩4个空位的状态只能转移到3个空位或两个空位,此时对手必胜,所以自己必败,以此类推 #include<iostream> using namespace std;
阅读全文
摘要:给定平面上 20×2120×21 个整点 (�,�)∣0≤�<20,0≤�<21,�∈�,�∈�(x,y)∣0≤x<20,0≤y<21,x∈Z,y∈Z,即横 坐标是 00 到 1919 (包含 00 和 1919) 之间的整数、纵坐标是 00 到 2020 (包含 00 和 2020) 之 间的整
阅读全文
摘要:.model small .data string db 'hsu dhiw dwi dwio','$' .code mov si,offset string outlp: cmp byte ptr[si],'$' jz done cmp byte ptr[si],' ' jz next mov d
阅读全文
摘要:.model small .data .code mov cx,66 push cx mov bx,70 push bx pop cx pop dx mov ah,2 int 21h .exit 0 end 输出B 先cx(66)进栈,然后bx(70)进栈,弹出bx(70),弹出cx(66) 66对
阅读全文
摘要:.model small .code mov ah,1 int 21h mov ah,2 mov dl,al int 21h .exit 0 end code segment assume cs:code start: mov ah,1 int 21h mov ah,2 mov dl,al int
阅读全文
摘要:.model small .code mov al,16 mov cx,240 xor bx,bx jmp again again: mov ah,2 mov dl,al int 21h;输出一个字符串 inc al;加一 inc bx .if bx==16 mov ah,2 mov dl,0DH
阅读全文
摘要:.model small .stack .data result db ? .code .startup mov result,5 .if result==5 mov ah,2 mov dl,66 int 21h .endif .exit 0 end
阅读全文
摘要:.model small .stack .data result db ? .code .startup xor al,al call sum mov result,al mov ah,2 mov dl,result int 21h .exit 0 sum proc cmp al,66 ja don
阅读全文
摘要:OUTPUT MACRO ASC MOV DL,ASC MOV AH,02H INT 21H ENDM ;输出单字符 CODES SEGMENT ASSUME CS:CODES MAIN PROC FAR START: MOV DL,10H ;用DL保存初始值10H MOV BL,0FH ;BL用作
阅读全文
摘要:.model small .stack 256 ;默认为1kb .data bufx db 66 bufy db 67 bufz db ? .code .startup mov al,bufx mov bl,bufy cmp al,bl ja next mov bufz,bl jmp done ne
阅读全文
摘要:普通 data segment ;数据段 string db 'Hello,World!$' data ends code segment ;代码段 assume cs:code,ds:data start: mov ax,data ;获取段基址 mov ds,ax ;将段基址送入寄存器 mov d
阅读全文
摘要:加农是罪的化身,所到之处污秽遍地。原先富丽堂皇的海鲁拉城堡也被加农污秽了。 根据调查,加农污秽一片地区有如下规律: 下图是一个矩形区域,Y=3,X=4。 "."表示干净区域,而"*"表示障碍物。 如果加农一开始在左下角(1,1),那么加农将会以如下态势污染区域: 加农将在4天后污染整个区域。 设区域
阅读全文
摘要:存储稀疏矩阵 十字链表法,十字链表压缩存储稀疏矩阵详解 (biancheng.net)
阅读全文
摘要:@起点,.终点,1障碍,0可以走,输出路径 #include <iostream> using namespace std; int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0}; int startx,starty,endx,endy,w,l; char puzzle[10]
阅读全文
摘要:小蓝有一个超大的仓库,可以摆放很多货物。 现在,小蓝有 �n 箱货物要摆放在仓库,每箱货物都是规则的正方体。小蓝规定了长、宽、高三个互相垂直的方向,每箱货物的边都必须严格平行于长、宽、高。 小蓝希望所有的货物最终摆成一个大的长方体。即在长、宽、高的方向上分别堆 �L、�W、�H 的货物,满足 �=�
阅读全文
摘要:#include<iostream> #include<string.h> #include<stdio.h> #include<fstream> using namespace std; int next[10]; void Next(char*T,int n) { int i=1,j=0; ne
阅读全文
摘要:冒泡 #include<iostream> #include<algorithm> #include<cmath> using namespace std; const int N=100000; int n; int nums[N]; int main() { scanf("%d",&n); fo
阅读全文