![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
暴力
文章平均质量分 62
允雨琉
永远的萌新
展开
-
hdu5536 Chip Factory (暴力+优化)
暴力+优化 话说网上有字典树的正规解法,不过hdu重现赛时并不会,于是直接暴力了。 优化方式直接在代码注释中标注了,这里不详解了。 #include #include using namespace std; const int MAXN = 1005; int a[MAXN]; inline int lowbit(int x) { return x & -x; } i原创 2015-11-01 21:44:29 · 1114 阅读 · 0 评论 -
ural1014 Product of Digits (枚举)
从9到2对原来的数进行试除,除完之后若不等于1,则无解,否则将之前的试除出来的因子从小到大输出。特殊情况:0的时候为10,1的时候为1。 #include using namespace std; int a[100]; int m; int main() { int n; scanf("%d", &n); if (n == 0) { printf("10\原创 2017-02-22 19:15:46 · 161 阅读 · 0 评论 -
ural1005 Stone Pile (枚举)
枚举n个石头的状态(即分在左还是右),然后找到答案最小的状态。 #include using namespace std; int a[25]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); int ans = 0x3f3f3f3f;原创 2017-02-22 22:58:05 · 361 阅读 · 0 评论