Codeforces Round #272 (Div. 1)B(构造)
来源:互联网 发布:mac怎么设置屏幕 编辑:程序博客网 时间:2024/04/28 09:28
Dreamoon likes to play with sets, integers and . is defined as the largest positive integer that divides both a and b.
Let S be a set of exactly four distinct integers greater than 0. Define S to be of rank k if and only if for all pairs of distinct elements si, sjfrom S, .
Given k and n, Dreamoon wants to make up n sets of rank k using integers from 1 to m such that no integer is used in two different sets (of course you can leave some integers without use). Calculate the minimum m that makes it possible and print one possible solution.
The single line of the input contains two space separated integers n, k (1 ≤ n ≤ 10 000, 1 ≤ k ≤ 100).
On the first line print a single integer — the minimal possible m.
On each of the next n lines print four space separated integers representing the i-th set.
Neither the order of the sets nor the order of integers within a set is important. If there are multiple possible solutions with minimal m, print any one of them.
1 1
51 2 3 5
2 2
222 4 6 2214 18 10 16
- Codeforces Round #272 (Div. 1)B(构造)
- Codeforces Round #277 (Div. 2)(B)构造
- Codeforces Round #347 (Div. 2) B Rebus (贪心构造)
- Codeforces Round #209 (Div. 2) B && Codeforces 359 B(构造)
- Codeforces Round #283 (Div. 2) B. Secret Combination 构造+枚举
- Codeforces Round #268 (Div. 1)A(构造)
- Codeforces Round #272 (Div. 2) B
- Codeforces Round #272 (Div. 2) B
- Codeforces Round #278 (Div. 2)---B. Candy Boxes (暴力+构造)
- Codeforces Round #268 (Div. 1)B(dfs)
- Codeforces Round #276 (Div. 1)B(暴力)
- Codeforces Round #276 (Div. 1) B. Maximum Value(哈兮)
- Codeforces Round #192 (Div. 1) B. Biridian Forest(BFS)
- Codeforces Round #245 (Div. 1) -- B. Working out (DP)
- Codeforces Round #245 (Div. 1) B. Working out(DP)
- Codeforces Round #366 (Div. 1) B. Ant Man (贪心)
- Codeforces Round #380 Div. 1 B. Sea Battle(贪心)
- Codeforces Round #336 (Div. 1)B. Zuma (区间DP)
- Ubuntu安装jdk
- 正则表达式相关
- 第一章知识结构导图(原来浏览器无法上传)
- 3D 打印 printbot 教程集合
- 解释BOM头和去掉方法
- Codeforces Round #272 (Div. 1)B(构造)
- 手机耳机接口标准
- nyoj-768-移位密码
- 深入理解fork()
- 数据结构 第二章《线性表》思维导图
- 【Android 初学】12、Service
- 2014牡丹江区域赛D(概率DP)ZOJ3822
- Cocos2d-x的生成Json文件的方法(续上续,哈哈)
- C++ ACE