/images/avatar.png

Patrick Weizhi Xu

USACO Party Lamps

有 \(N\) \((10 \le N \le 100)\) 盏亮瞎眼的灯,从 1 到 N 编号。 有四种按钮: 按钮 用途 1 反转所有的灯(开变为关,关变为开) 2 反转编号为奇数的灯(如 1,3,5) 3 反转

POJ 3268 Silver Cow Party

有 \(N\) (\(1 \le N \le 1000\)) 个农场, 每个农场有1只奶牛去X号农场参加派对。每只奶牛都要走最短路来回。一共有 \(M\) (\(1 \le M \le 100,000\))单向道路,每条道路

UVa 108 Maximum Sum

给定一个\(N \times N (N \le 100)\)的矩阵,找到最大子矩阵和。 链接: 题目UVa 题解 首先想到暴力,复杂度\(O(N^6)\),肯定超时。 然后有一

UVa 443 Humble Numbers

找到第\(n\) \( (1 \le n \le 5842)\) 个只有2,3,5或7质因子的数。 链接: https://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=384 ###题解 ####解法1 有点暴力。。。 用STL set和vector来枚举

POJ 2376 Cleaning Shifts

\(N\) (\(1 \le N \le 25,000\))只蛤,每只蛤只能在特定时间段工作。 \(T\) (\(1 \le T \le 1,000,000\))个时间段。 找到最少蛤数能覆盖整个时间段。 链接