题目链接: B.Table 题意: \(n*m\)的矩阵使每个\(n*n\)矩阵里面准确包含\(k\)个点,问你有多少种放法. \((1 ≤ n ≤ 100; n ≤ m ≤ 10^{18}; 0 ≤ k ≤ n^2)\) 题解: - Let \(s_i\) number of points in the column \(i\). - Two neighboring squares are drawn at this picture, \(A\) is the number of point…
题目链接: http://codeforces.com/problemset/problem/650/C C. Table Compression time limit per test4 secondsmemory limit per test256 megabytes 问题描述 Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and m…
CodeForces - 233D 题目大意给你一个n*m 的矩阵,要求你进行涂色,保证每个n*n的矩阵内都有k个点被涂色. 问你一共有多少种涂色方案. n<=100 && m<=1e18 看数据范围感觉是个矩阵快速幂优化的dp,各种想,连状态转移方程都想不出来,我真 鸡儿菜!!!!,这种和概率有关的dp我感觉好蓝啊!!! 思路:显然是个dp,我们另dp[ i ][ j ]表示,到 i 列,一共涂了j个格子的种数, 那么有状态转移方程 dp[ i ][ j ] +=Σ(dp[…
原题链接:http://codeforces.com/gym/100338/attachments/download/2136/20062007-winter-petrozavodsk-camp-andrew-stankevich-contest-22-asc-22-en.pdf 题意 给你n个点,让你连边,使得每个点的度至少为1,问你方案数. 题解 从正面考虑非常困难,应从反面考虑,取 i 点出来不连,这样的取法一共有C(n,i)种取法,其他的连好,而这样就是子问题了.那么dp[n]=2^(n…
C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output — This is not playing but duty as allies of justice, Nii-chan! — Not allies but justice itself, Onii-chan! With h…
题目传送门 /* 贪心:排序后,当a[3] > 2 * (a[1] + a[2]), 可以最多的2个,其他的都是1个,ggr,ggb, ggr... ans = a[1] + a[2]; 或先2个+1个,然后k个rgb...r = x + k; g = 2 * (x + z) + k; b = z + k; ans = (x + z) + k = (a[1] + a[2] + a[3]) / 3; 隔了一段时间有做到这题又不会了,看别人的解题报告水平果然没有提升,以后做题要独立思考,看别人的也要…
Codeforces #345 Div.1 打CF有助于提高做题的正确率. Watchmen 题目描述:求欧拉距离等于曼哈顿距离的点对个数. solution 签到题,其实就是求有多少对点在同一行或同一列. 时间复杂度:\(O(nlogn)\) Image Preview 题目描述:给定看一张照片的时间,翻页的时间,把图片翻转的时间.一开始屏幕显示第一张照片,可以向左或向右翻,不能跳过还没有看过的图片,方向不对的图片要先翻转再看,看过的不消耗翻转时间与看照片时间,问在一定时间内,最多能看多少张照…
[CodeForces - 1272D] Remove One Element [线性dp] 标签:题解 codeforces题解 dp 线性dp 题目描述 Time limit 2000 ms Memory limit 262144 kB Source Codeforces Round #605 (Div. 3) Tags brute force   dp   *1500 Site https://codeforces.com/problemset/problem/1272/D 题面 Exam…
div 标签上写  style="text-align:center" div中的table中写 style="margin:auto;"  <table  style="margin:auto;"  margin代表 外边距 顺时针方向数  上 右 下 左   一共可以写四个. http://www.w3school.com.cn/cssref/pr_margin.asp…
题目链接:http://codeforces.com/contest/219/problem/D 树dp //#pragma comment(linker, "/STACK:102400000, 102400000") #include <algorithm> #include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #include…
Codeforces #344 Div.2 Interview 题目描述:求两个序列的子序列或操作的和的最大值 solution 签到题 时间复杂度:\(O(n^2)\) Print Check 题目描述:有一个棋盘,对其进行染色,每次染一行或一列,后来的颜色会覆盖原来的颜色,输出最后的棋盘. solution 题解用二维线段树,其实可以不用. 对染色进行离线操作,那么染过的格子.行.列就不用再染了.所以每个格子可以记录四个指针,分别是行前驱,行后继,列前驱列后继,染色时按照这个跳着来染就好了.…
1:速度和加载方式方面的区别 div 的加载方式是即读即加载,遇到 <div> 没有遇到 </div> 的时候一样加载 div 中的内容,读多少加载多少:table 的加载方式是完成后加载,遇到 <table> 后,在读到 </table> 之前,table 中的内容不加载,或者传输中断了(document.onload()事件)的时候加载,这是因为TABLE牵涉到多行多列问题,所以只有当TABLE所有内容加载完毕,IE才知道该怎么显示 2:在网页应用中的差…
<div style="text-align:center"> <table border="1" cellpadding="3" cellspacing="0" style="width: 60%;margin:auto"> <tr><td></td></tr> </table> </div> 有时候在div中…
Codeforces Beta Round #27 (Codeforces format, Div. 2) http://codeforces.com/contest/27 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define sqr(x) ((x)*(x)) #define maxn 1000005 typ…
题目描述 给你一个长度为 $n$ 的序列 $\{a_i\}$ 和一个数 $x$ ,对于任意一个 $1\sim n$ 的排列 $\{p_i\}$ ,从 $1$ 到 $n$ 依次执行 $x=x\ \text{mod}\ a_{p_i}$ ,最终得到一个数.求所有排列中能够得到的这个数的最大值,以及有多少种排列可以得到这个值. $n\le 1000$ ,$x\le 5000$ . 题解 组合数学+dp 由于 $a\ \text{mod}\ b<b$ ,因此每次产生影响(即 $x\ \text{mod}…
一.div居中 margin-left: auto;margin-right: auto; <div  style="width:960px ; margin-left: auto;margin-right: auto;"  ></div> 二.table居中 margin:auto; .searchclass { width:960px; min-height:80px; border-right:1px solid #000;border-bottom:1p…
题目描述 传说很久以前,大地上居住着一种神秘的生物:地精. 地精喜欢住在连绵不绝的山脉中.具体地说,一座长度为 N 的山脉 H可分 为从左到右的 N 段,每段有一个独一无二的高度 Hi,其中Hi是1到N 之间的正 整数. 如果一段山脉比所有与它相邻的山脉都高,则这段山脉是一个山峰.位于边 缘的山脉只有一段相邻的山脉,其他都有两段(即左边和右边). 类似地,如果一段山脉比所有它相邻的山脉都低,则这段山脉是一个山谷. 地精们有一个共同的爱好——饮酒,酒馆可以设立在山谷之中.地精的酒馆 不论白天黑夜总…
Codeforces#441 Div.2 四小题 链接 A. Trip For Meal 小熊维尼喜欢吃蜂蜜.他每天要在朋友家享用N次蜂蜜 , 朋友A到B家的距离是 a ,A到C家的距离是b ,B到C家的距离是c  (A- >Rabbit   B- >Owl    C ->Eeyore),他不能连续两顿饭都在同一位朋友家里蹭 他现在位于A的家里, 请问他一天最少要跑多少路. 当然是要找一条最短的路折返跑了啊,是不是很简单. #include<bits/stdc++.h> us…
codeforces #592(Div.2) A Pens and Pencils Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for th…
codeforces #578(Div.2) A. Hotelier Amugae has a hotel consisting of 1010 rooms. The rooms are numbered from 00 to 99 from left to right. The hotel has two entrances - one from the left end, and another from the right end. When a customer arrives to t…
codeforces #577(Div.2) A  Important Exam A class of students wrote a multiple-choice test. There are nn students in the class. The test had mm questions, each of them had 55 possible answers (A, B, C, D or E). There is exactly one correct answer for…
本文主要针对需要全屏显示的系统页面内,因为系统经常会用到表格table布局,偶尔的table需要显示在div的正中间,所以鄙人特此总结下div内table的万千姿态. <!DOCTYPE html><html> <head><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /> <title>i冰冰的个人博客</title> &…
http://codeforces.com/contest/599/problem/D 题意:给出总的方格数x,问有多少种不同尺寸的矩形满足题意,输出方案数和长宽(3,5和5,3算两种) 思路:比赛的时候gg了..其实稍微在纸上推一下.就会得到对于n,m的矩形,一共会有-n*n*n+3*n*n*m+n+3*n*m的方格.数量级是n3. 我们可以实际跑一遍.发现对于x1E18的数量级,n不会超过1442550,1E6,可以搞. 需要注意的是,一个是会爆int,所以记得用long long 另一个是…
题目链接: http://codeforces.com/contest/889/problem/C 题意: 给你 \(n\)和 \(k\). 让你找一种全排列长度为\(n\)的 \(p\),满足存在下标 \(i\),\(p_i\)大于所有 \(p_j\),\(j\epsilon[1,i-1]\)同时大于所有\(p_i\),\(j\epsilon[i+1,i+k]\).问你满足这样条件的排列有多少种? 题解: 设\(dp[i]\)表示以 \(i\) 结尾的,满足题目要求的\(1\) ~ \(i\)…
题目链接:http://codeforces.com/contest/283/problem/B 思路: dp[now][flag]表示现在在位置now,flag表示是接下来要做的步骤,然后根据题意记忆化搜索记忆,vis数组标记那些已经访问过的状态. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define REP(i, a, b) for (i…
题目链接: http://codeforces.com/problemset/problem/214/E Relay Race time limit per test4 secondsmemory limit per test256 megabytes 问题描述 Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The gi…
C. Running Track 题目连接: http://www.codeforces.com/contest/615/problem/C Description A boy named Ayrat lives on planet AMI-1511. Each inhabitant of this planet has a talent. Specifically, Ayrat loves running, moreover, just running is not enough for hi…
B. Longtail Hedgehog 题目连接: http://www.codeforces.com/contest/615/problem/B Description This Christmas Santa gave Masha a magic picture and a pencil. The picture consists of n points connected by m segments (they might cross in any way, that doesn't m…
题目链接:http://codeforces.com/problemset/problem/455/A 给你n个数,要是其中取一个大小为x的数,那x+1和x-1都不能取了,问你最后取完最大的和是多少. 简单dp,dp[i]表示取i时zui最大和为多少,方程为dp[i] = max(dp[i - 1] , dp[i - 2] + cont[i]*i). #include <bits/stdc++.h> using namespace std; typedef __int64 LL; ; LL a…
题目地址:http://codeforces.com/contest/456/problem/C 脑残了. .DP仅仅DP到了n. . 应该DP到10w+的. . 代码例如以下: #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <cty…