随笔分类 -  ACM

摘要:题目描述 在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。多多决定把所有的果子合成一堆。 每一次合并,多多可以把两堆果子合并到一起,消耗的体力等于两堆果子的重量之和。可以看出,所有的果子经过n-1次合并之后,就只剩下一堆了。多多在合并果子时总共消耗的体力等于每次合并所 阅读全文
posted @ 2018-07-18 14:16 house_cat 阅读(362) 评论(0) 推荐(0)
摘要:题目描述 一列火车n节车厢,依次编号为1,2,3,…,n。每节车厢有两种运动方式,进栈与出栈,问n节车厢出栈的可能排列方式有多少种。 输入 一个数,n(n<=60000) 输出 一个数s表示n节车厢出栈的可能排列方式 题解: 这题要用大数,java 然后卡特兰数:有个数学模型 s[i]=c(n,2n 阅读全文
posted @ 2018-07-16 23:43 house_cat 阅读(521) 评论(0) 推荐(0)
摘要:题目描述 这里有n列火车将要进站再出站…… 但是,每列火车只有1节 那就是车头…… 描述 有n列火车按1到n的顺序从东方左转进站,这个车站是南北方向的,它虽然无限长,只可惜是一个死胡同,而且站台只有一条股道,火车只能倒着从西方出去,而且每列火车必须进站,先进后出。 (某生:不就是个栈吗?每次可以让右 阅读全文
posted @ 2018-07-11 22:10 house_cat 阅读(1127) 评论(0) 推荐(0)
摘要:题目描述 Fennec and Snuke are playing a board game. On the board, there are N cells numbered 1 through N, and N−1 roads, each connecting two cells. Cell a 阅读全文
posted @ 2018-07-10 22:58 house_cat 阅读(327) 评论(0) 推荐(0)
摘要:题目描述 你玩过“拉灯”游戏吗?25盏灯排成一个5x5的方形。每一个灯都有一个开关,游戏者可以改变它的状态。每一步,游戏者可以改变某一个灯的状态。游戏者改变一个灯的状态会产生连锁反应:和这个灯上下左右相邻的灯也要相应地改变其状态。 我们用数字“1”表示一盏开着的灯,用数字“0”表示关着的灯。下面这种 阅读全文
posted @ 2018-07-07 00:19 house_cat 阅读(257) 评论(0) 推荐(0)
摘要:题目描述 给定一张 n(n≤20) 个点的带权无向图,点从 0~n-1 标号,求起点 0 到终点 n-1 的最短Hamilton路径。 Hamilton路径的定义是从 0 到 n-1 不重不漏地经过每个点恰好一次。 输入 第一行一个整数n。 接下来n行每行n个整数,其中第i行第j个整数表示点i到j的 阅读全文
posted @ 2018-07-06 12:25 house_cat 阅读(318) 评论(0) 推荐(1)
摘要:题目描述 There are N towns on a plane. The i-th town is located at the coordinates (xi,yi). There may be more than one town at the same coordinates. You c 阅读全文
posted @ 2018-07-06 00:11 house_cat 阅读(297) 评论(0) 推荐(0)
摘要:题目描述 You are given an integer sequence of length N. The i-th term in the sequence is ai. In one operation, you can select a term and either increment 阅读全文
posted @ 2018-06-10 22:31 house_cat 阅读(271) 评论(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-07 12:56 house_cat 阅读(295) 评论(0) 推荐(1)
摘要:题目描述 Let’s consider some math problems. JSZKC has a set A={1,2,…,N}. He defines a subset of A as ‘Meo set’ if there doesn’t exist two integers in this 阅读全文
posted @ 2018-06-05 19:58 house_cat 阅读(559) 评论(0) 推荐(0)
摘要:题目描述 Plague Inc. is a famous game, which player develop virus to ruin the world. JSZKC wants to model this game. Let’s consider the world has N*M citi 阅读全文
posted @ 2018-06-05 19:35 house_cat
摘要:题目描述 Persona5 is a famous video game. In the game, you are going to build relationship with your friends. You have N friends and each friends have his 阅读全文
posted @ 2018-06-05 12:36 house_cat
摘要:题目描述 N hotels are located on a straight line. The coordinate of the i-th hotel (1≤i≤N) is xi. Tak the traveler has the following two personal principl 阅读全文
posted @ 2018-05-31 11:12 house_cat
摘要:题目描述 Given l1,r1,l2,r2,l3,r3,l4,r4, please count the number of four-tuples (x1,x2,x3,x4) such that li≤ xi≤ ri and x1≠x2,x2≠x3,x3≠x4,x4≠x1. The answer 阅读全文
posted @ 2018-05-27 17:13 house_cat
摘要:题目描述 There are N cities. There are also K roads and L railways, extending between the cities. The i-th road bidirectionally connects the pi-th and qi- 阅读全文
posted @ 2018-05-27 11:51 house_cat 阅读(369) 评论(0) 推荐(0)
摘要:AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report sho 阅读全文
posted @ 2018-05-25 20:48 house_cat 阅读(168) 评论(0) 推荐(0)
摘要:题目描述 Alice and Bob are playing a stone game. There are n piles of stones. In each turn, a player can remove some stones from a pile (the number must b 阅读全文
posted @ 2018-05-15 15:33 house_cat 阅读(272) 评论(0) 推荐(0)
摘要:遇到了一个题: Description: Goldbach's conjecture is one of the oldest and best-known unsolved problems in number theory and all of mathematics. It states: E 阅读全文
posted @ 2018-04-23 23:25 house_cat 阅读(1569) 评论(0) 推荐(0)
摘要:题目描述 There are N boxes arranged in a circle. The i-th box contains Ai stones. Determine whether it is possible to remove all the stones from the boxes 阅读全文
posted @ 2018-04-19 23:27 house_cat 阅读(323) 评论(0) 推荐(0)
摘要:题目描述 There are N squares aligned in a row. The i-th square from the left contains an integer ai. Initially, all the squares are white. Snuke will perf 阅读全文
posted @ 2018-04-19 22:56 house_cat 阅读(305) 评论(0) 推荐(0)