码迷,mamicode.com
首页 >  
搜索关键字:for while    ( 28479个结果
LG P5056 【模板】插头dp
Descriprion 给出$n\times m$ 的方格,有些格子不能铺线,其它格子必须铺,形成一个闭合回路。问有多少种铺法? Solution 使用括号表示法记录状态,记1为 '(' ,2为 ')' ,0为无插头,分8种情况讨论: 1:当前格子有障碍,此时必须下插头和右插头为0,转移后状态不变 ...
分类:其他好文   时间:2020-07-29 17:30:42    阅读次数:68
sql-批量删除数据
--每次删多少 DECLARE @BatchSize INT = 100 WHILE 1 = 1 BEGIN DELETE TOP (@BatchSize) FROM tb WHERE id>30 IF @@ROWCOUNT < @BatchSize BREAK END ...
分类:数据库   时间:2020-07-29 15:33:08    阅读次数:69
AcWing 829. 模拟队列
AcWing 829. 模拟队列 #include <bits/stdc++.h> using namespace std; const int N=1e6+10; int q[N],hh,tt; void init(){ hh=0; tt=-1; } void add(int x){ q[++tt ...
分类:Windows程序   时间:2020-07-29 15:09:36    阅读次数:80
二进制回文数
##输出1到n以内所有的二进制回文数 #include <stdio.h> #define SIZE 50 typedef enum bool Bool; enum bool { false, true }; int main() { int n, i, j; Bool flag = false; ...
分类:其他好文   时间:2020-07-29 10:02:00    阅读次数:84
BFS模板
如果不需要确定当前遍历到了哪一层,BFS模板如下。 while queue 不空: cur = queue.pop() for 节点 in cur的所有相邻节点: if 该节点有效且未访问过: queue.push(该节点) 如果要确定当前遍历到了哪一层,BFS模板如下。 这里增加了level表示当 ...
分类:其他好文   时间:2020-07-28 22:38:05    阅读次数:77
luoguP1967 货车运输
题面 #include <bits/stdc++.h> using namespace std; template<typename temp> void read(temp &x){ x = 0; temp f = 1; char ch; while(!isdigit(ch = getchar() ...
分类:其他好文   时间:2020-07-28 22:35:46    阅读次数:61
Java Map的用法
Map Map的遍历可以通过键找值得方式,也可以一个个键值对的遍历 使用key遍历 方法一 : iterator+key Map<String, Object> map = new HashMap<String, Object>(); map.put("name", "Tom"); map.put( ...
分类:编程语言   时间:2020-07-28 22:22:11    阅读次数:75
7-18 二分法求多项式单根 (20分)
#include<iostream> #include<cstdio> using namespace std; float a, b, c, d; float l, r; float clac(float x){ return a * x * x * x + b * x * x + c * x + ...
分类:其他好文   时间:2020-07-28 22:15:33    阅读次数:72
《算法竞赛进阶指南》0x51线性DP Cookies
题目链接:https://www.acwing.com/problem/content/279/ 题目给定一个长度为n的序列g,和一个数m,要求将m分成n份,设定为数列a,使得数列g与数列a的乘积最小。根据排序不不等式,在g是升序的情况下,a是降序才会使得结果最小。所以对g进行降序排序之后,题意中的 ...
分类:编程语言   时间:2020-07-28 14:39:38    阅读次数:80
Leetcode.283 | Move Zeroes(Python)
Leetcode.283 Move Zeroes Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero e ...
分类:编程语言   时间:2020-07-28 14:38:35    阅读次数:91
28479条   上一页 1 ... 73 74 75 76 77 ... 2848 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!