一开始发现的性质是确定了第一行后,后面的行只需要考虑和前面的行相同或者不同,整个过程只需要考虑行,构出的图一定符合性质(即同样满足列的性质),但是接下来死活定义不出状态,事实证明自己还是想的太少了

思路:https://www.cnblogs.com/tobyw/p/9513876.html

代码:

#include<bits/stdc++.h>
#define ll long long
#define mk make_pair
#define ft first
#define se second
#define pii pair<int,int>
#define db double
#define ls o<<1
#define rs o<<1|1
#define lowbit(x) (x&-x)
using namespace std;
const ll P = 998244353;
ll n, k, f[505][505], res[505];
int main(){
cin >> n >> k;
for(int i = 1; i <= n; i++){
f[0][i] = 1;
for(int j = 1; j <= n; j++){
for(int p = 1; p <= min(i, j); p++){
f[j][i] += f[j - p][i];
f[j][i] %= P;
}
}
}
ll ans = 0;
for(int i = 1; i <= n; i++){
res[i] = (f[n][i] - f[n][i - 1] + P) % P;
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
if(i * j < k){
ans += res[i] * res[j] % P;
ans %= P;
}else
break;
}
}
ans *= 2;
ans %= P;
cout << ans << endl;
return 0;
}

codeforces 1027E. Inverse Coloring(计数)的更多相关文章

  1. Codeforces 1027E Inverse Coloring 【DP】

    Codeforces 1027E Inverse Coloring 题目链接 #include<bits/stdc++.h> using namespace std; #define N ...

  2. CF 1027E Inverse Coloring

    当天晚上并没有看懂题意,然后就刚了40分钟F,但是没有弄出来呜呜呜. 推荐博客:  https://blog.csdn.net/Dream_maker_yk/article/details/81840 ...

  3. codeforces 1027 E. Inverse coloring (DP)

    E. Inverse Coloring time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  4. CodeForces #369 C. Coloring Trees DP

    题目链接:C. Coloring Trees 题意:给出n棵树的颜色,有些树被染了,有些没有.现在让你把没被染色的树染色.使得beauty = k.问,最少使用的颜料是多少.   K:连续的颜色为一组 ...

  5. codeforces 711C C. Coloring Trees(dp)

    题目链接: C. Coloring Trees time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  6. Codeforces 711 C. Coloring Trees (dp)

    题目链接:http://codeforces.com/problemset/problem/711/C 给你n棵树,m种颜色,k是指定最后的完美值.接下来一行n个数 表示1~n树原本的颜色,0的话就是 ...

  7. Codeforces 980D Perfect Groups 计数

    原文链接https://www.cnblogs.com/zhouzhendong/p/9074164.html 题目传送门 - Codeforces 980D 题意 $\rm Codeforces$ ...

  8. CodeForces 57C Array 组合计数+逆元

    题目链接: http://codeforces.com/problemset/problem/57/C 题意: 给你一个数n,表示有n个数的序列,每个数范围为[1,n],叫你求所有非降和非升序列的个数 ...

  9. CodeForces 1065E. Side Transmutations 计数

    昨天不该早点走的.... 首先操作限制实际上是一个回文限制 每个$b[i] - b[i - 1]$互不干扰,不妨设这个串关于中心点对称的这么一对区间的串分别为$(S_1, S_2)$ 题目的限制相当与 ...

随机推荐

  1. vue.js 本地解决跨域

    1.config/index.js下添加proxyTable dev: { // Paths assetsSubDirectory: 'static', assetsPublicPath: '/', ...

  2. MySQL数据库~~~~~创建用户和授权、备份和还原

    一 MySQL创建用户和授权 1.1 对新用户增删改 1.创建用户: # 指定ip:192.118.1.1的chao用户登录 create user 'chao'@'192.118.1.1' iden ...

  3. diango中的MTV——FBV/CBV以及装饰器的复用问题解决

    MVC M: model 模型 与数据库交互 V: view 视图 HTML C:controller 控制器 流程 和 业务逻辑 MTV M:model ORM T:template 模板 HTML ...

  4. C# List、Array、Dictionary之间相互转换

    Array转换为List List转换为Array Array转Dictionary Dictionary转Array List转Dictionary Dictionary转List IQueryab ...

  5. 重启宝塔面板后提示-ModuleNotFoundError: No module named 'geventwebsocket'

    背景: 因服务器部署了flask项目,安装了python3,故重启宝塔面板报错 [Traceback (most recent call last): File , in load_class mod ...

  6. BITCTF-MISC

    MISC 以此笔记来记录本菜鸡做misc的历程 签到85 首先看题 提示base85 打开kali,使用python的base64库来解码(内有base85解码) (其实只要输python3即可 我还 ...

  7. 11-《Node.js开发指南》-模块和包

    什么是模块? 一个node.js文件就是一个模块,这个文件可能是js代码,json或者编译过的C/C++扩展 创建及加载模块 //a.js var name; exports.setName = fu ...

  8. linux 常用命令及软件

    命令基于ubuntu 18.04 修改网卡配置 /etc/netplan/50-cloud-init.yaml #修改 netplan apply #应用修改 修改计算机名 sudo hostname ...

  9. 推荐几本高质量的Python书籍--附github下载路径

    一 为什么要分享? 最近碰到了一些人和事,感触挺大的.就是发现很多类似自己的软件工程师,一旦工作三五年之后,工作中算是一个熟练工,但是进步的脚步突然慢了下来,虽然你在工作中仍旧很努力.到底是什么原因呢 ...

  10. String对象及正则表达式

    1,String和string还是有区别的,一个就是用双引号或单引号包括起来的数据就是字符串,另一个本质是数组多个字符串组成的只读字符数组: 2,你说string他是数组吧,他和数组还是有点区别的,他 ...