摘要: 题目描述 There are infinitely many cards, numbered 1, 2, 3, … Initially, Cards x1, x2, …, xN are face up, and the others are face down.Snuke can perform t 阅读全文
posted @ 2018-07-24 23:04 行远山 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网 Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (lq, 阅读全文
posted @ 2018-07-23 23:27 行远山 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Farmer John's N cows (1≤N≤105), numbered 1…N as always, happen to have too much time on their hooves. As a result, they have worked out a complex 阅读全文
posted @ 2018-07-22 22:11 行远山 阅读(289) 评论(0) 推荐(0) 编辑
摘要: Let's call an undirected graph G=(V,E)G=(V,E) relatively prime if and only if for each edge (v,u)∈E(v,u)∈E GCD(v,u)=1GCD(v,u)=1 (the greatest common d 阅读全文
posted @ 2018-07-18 10:20 行远山 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 问题 E: 费解的开关 题目描述 你玩过“拉灯”游戏吗?25盏灯排成一个5x5的方形。每一个灯都有一个开关,游戏者可以改变它的状态。每一步,游戏者可以改变某一个灯的状态。游戏者改变一个灯的状态会产生连锁反应:和这个灯上下左右相邻的灯也要相应地改变其状态。我们用数字“1”表示一盏开着的灯,用数字“0” 阅读全文
posted @ 2018-07-04 19:52 行远山 阅读(1212) 评论(0) 推荐(1) 编辑
摘要: 题目描述 给定一张 n(n≤20) 个点的带权无向图,点从 0~n-1 标号,求起点 0 到终点 n-1 的最短Hamilton路径。 Hamilton路径的定义是从 0 到 n-1 不重不漏地经过每个点恰好一次。 输入 第一行一个整数n。接下来n行每行n个整数,其中第i行第j个整数表示点i到j的距 阅读全文
posted @ 2018-06-23 11:40 行远山 阅读(672) 评论(0) 推荐(0) 编辑
摘要: time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output time limit per test 2 seconds time limit 阅读全文
posted @ 2018-06-11 18:54 行远山 阅读(457) 评论(0) 推荐(0) 编辑
摘要: Ezio learned a lot from his uncle Mario in Villa Auditore. He also made some contribution to Villa Auditore. One of the contribution is dividing it in 阅读全文
posted @ 2018-06-11 14:54 行远山 阅读(338) 评论(0) 推荐(0) 编辑
摘要: Some company is going to hold a fair in Byteland. There are nn towns in Byteland and mm two-way roads between towns. Of course, you can reach any town 阅读全文
posted @ 2018-06-06 21:15 行远山 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题目描述 JSZKC is going to spend his vacation! His vacation has N days. Each day, he can choose a T-shirt to wear. Obviously, he doesn’t want to wear a si 阅读全文
posted @ 2018-06-05 22:27 行远山 阅读(338) 评论(0) 推荐(0) 编辑