码迷,mamicode.com
首页 >  
搜索关键字:ret    ( 30742个结果
刷题第2天
CF 590D Top Secret Task 题目 给一个长度为n的数组,可以交换s次相邻元素,求前k个元素和最小为多少 $1?\leqslant?k?\leqslant?n?\leqslant?150, 1?\leqslant?s?\leqslant?10^9$ $1\leqslant q_i ...
分类:其他好文   时间:2020-12-21 12:02:11    阅读次数:0
完全平方数
复习bfs 这题我们用bfs 做 class Solution { public: int numSquares(int n) { queue <int> q; vector <int> dist(n+1,INT_MAX); q.push(0); dist[0] = 0; while(q.size( ...
分类:其他好文   时间:2020-12-21 12:01:05    阅读次数:0
N皇后问题 -Python
import time """ N 皇后问题,不同皇后不能放置在同一直线或对角线上 """ def Nqueen(n): # arr[i] 表示每行皇后放置的第几列 arr = [0 for i in range(n)] cnt = 0 i = 0 resume_flag = False # 回溯标 ...
分类:编程语言   时间:2020-12-21 11:17:30    阅读次数:0
最大公约数
#include<stdio.h>intmain(){intm=24;intn=18;intr=0;while(m%n){r=m%n;m=n;n=r;}printf("%d\n",n);return0;}
分类:其他好文   时间:2020-12-21 11:13:24    阅读次数:0
打印闰年 打印素数
//打印闰年#include<stdio.h>intmain(){intyear=0;intcount=0;for(year=1000;year<=2000;year++){if(year%4==0&&year%100!=0){printf("%d",year);count++;}elseif(year%400==0){printf("%d",year);coun
分类:其他好文   时间:2020-12-21 11:12:56    阅读次数:0
打印闰年 打印素数
//打印闰年#include<stdio.h>intmain(){intyear=0;intcount=0;for(year=1000;year<=2000;year++){if(year%4==0&&year%100!=0){printf("%d",year);count++;}elseif(year%400==0){printf("%d",year);coun
分类:其他好文   时间:2020-12-21 11:12:41    阅读次数:0
leetcode_面试题 01.08. 零矩阵
编写一种算法,若M × N矩阵中某个元素为0,则将其所在的行与列清零。 示例 1: 输入: [ [1,1,1], [1,0,1], [1,1,1] ] 输出: [ [1,0,1], [0,0,0], [1,0,1] ] 示例 2: 输入: [ [0,1,2,0], [3,4,5,2], [1,3,1 ...
分类:其他好文   时间:2020-12-21 11:05:10    阅读次数:0
215. 数组中的第K个最大元素
题目链接:https://leetcode-cn.com/problems/kth-largest-element-in-an-array/ 1 先快速排序,再取第 K个 class Solution { public int findKthLargest(int[] nums, int k) { ...
分类:编程语言   时间:2020-12-19 12:57:18    阅读次数:1
142. 环形链表 II(找循环点)
给定一个链表,返回链表开始入环的第一个节点。 如果链表无环,则返回 null。表为无头结点、单向。(由于涉及到结构体,所以写不了完整的测试代码,下面展示的代码为LeetCode中写的代码) //第一次尝试://方法:图文解释: //当然,这个方法有点不好想,我们还可以这样做:(这里就不演示了) st ...
分类:其他好文   时间:2020-12-19 12:20:15    阅读次数:1
(十)登录拦截器之前后端
springboot的拦截器配置: 需要在登录的方法中添加一条语句,其实只是添加了一条语句 session.setAttribute("user", user); 新建 package 名为 interceptor,新建类 LoginInterceptor。 Interceptor 即拦截器,在 S ...
分类:其他好文   时间:2020-12-19 12:11:16    阅读次数:2
30742条   上一页 1 ... 59 60 61 62 63 ... 3075 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!