- 博客(17)
- 收藏
- 关注
原创 10297 : Podzielno 数论
结论: 一个数能被B-1整除当且仅当这个数在B进制下的每一位的和能被B-1整除。 证明: 当一个数的某一位+1时,若进位,则这一位要减去B-1,下一位要+1,则总的贡献是+1. 当一个数的某一位-1时,若退位,则这一位要加上B-1,下一位要-1,则总的贡献是-1. 于是当一个数加上B-1时,它在B进制下每一位的总和对B-1取模的值是不变的。 a*Bk≡a (mod (B-1) ) ...
2018-12-09 13:09:21 151
原创 【贪心】Mixing Milk
结构体排序 + tanxin 水题 /**/ #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <iostream> #include <algorithm> #include <map> #inc
2018-12-01 15:51:42 148
原创 Combination Lock
题目描述 农夫约翰的奶牛不停地从他的农场中逃出来,导致了很多损害。为了防止它们再逃出来,他买了一只很大的号码锁以防止奶牛们打开牧场的门。 农夫约翰知道他的奶牛很聪明,所以他希望确保它们不会在简单地试了很多不同的号码组合之后就能轻易开锁。锁上有三个转盘,每个上面有数字1..N (1 <= N <= 100),因为转盘是圆的,所以1和N是相邻的。有两种能开锁的号码组合,一种是农夫约翰设定...
2018-12-01 13:27:14 374
原创 【枚举】Prime Cryptarithm
这题的提议超重要啊。一定要仔细读,静下心来读。还有不要受以前做过什么题听说过什么的干扰。学长让我看这题,并且说这个应该就是素数加密的问题。然后我一直在想素数,看题目提示又不太对劲。再看样例,懵到不知道这题到底要干嘛。所以说啊。。。。 然后这题判断超级多,稍不注意就漏掉了它是几位数的判断,然后我就WA 了。 就按照题意模拟+判断就好了。 顺便学了一下HASH, O(1)复杂度 (反正给出的数...
2018-12-01 00:43:47 105
原创 【枚举】Broken Necklace
首先一定要先把题意读懂,读题时一定要专注仔细。题目读懂后还是思考,思考好了,条理清晰了,才可以开始码代码。 因为是环所以mencpy(s + n, s, n);然后, 用a表示前一段的连续长度, b表示当前段的连续长度, w表示在当前出现的w的连续数目. 然后还有一个需要注意的就是,如果全是一样的bead,为了防止结果超过n,我们直接min(n, res);就好了。 /**/ #in...
2018-11-30 23:43:33 142
原创 【模拟】Friday the Thirteenth
这题主要是需要开一个二维数组,巧妙解决闰年的问题。然后判断闰年之后直接去数组里取每个月的天数就好。 然后就是模拟,自增,取余。 先开始忘写fun()的返回值了,所以运行样例的结果总是错。。。很尴尬。 /**/ #include <cstdio> #include <cstring> #include <cmath> #include <cctype...
2018-11-30 20:53:02 118
原创 Greedy Gift Givers(模拟 + map)
先开始用vector<string>写超麻烦。。。。后来发现应该用map啊 emmmmm 还是水题。。。其实是我只能写出水题 #include<algorithm> #include<cstdio> #include<cstring> #include<iostream> #include<map> #include&l...
2018-11-28 22:52:44 106
原创 【字符串】Your Ride Is Here
这题真的是很实在的水题啊,解题的关键在于‘ up to 6 characters long.’本来以为串会很长啊或者还要高精度什么的,打开计算器确认过眼神,26^6只有9位数。果断水过。 #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include...
2018-11-28 21:16:43 263
原创 连续和和下标系列问题
上一篇补提写得超级麻烦啊。。。宛如智障 今天改了简单写法 /**/ #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <iostream> #include <algorithm> #include <m...
2018-10-30 19:43:16 117
原创 2018校赛补题及反思
这次竟然如此多的省赛原题。。然而我全都忘掉了,看不懂看不懂,看懂了的不会做 被打成自闭,失去梦想变成咸鱼 //所以省赛的题没有补,题目记不起来了的也没补 补了两题很多人做出来的 1.最后一题求K个连续和最大的下标 这题对我来说并没有很简单啊,回来还是写了一个多小时emmmmm,所以没有很可惜 可是为什么别人能当场做出来呢,气死我了 结论: 1/样例模拟一定要自动地全面考虑,尤其是负数,...
2018-10-28 11:27:23 138 1
原创 HDOJ 2091
今天又写了一道因为字符串输入没有getchar()而格式错误的题,PE了好多天,今天终于看出来别人AC的代码比我多了getchar(),啊啊啊,暴风哭泣 一定要记住 getchar() !!!...
2018-09-24 21:55:13 229
原创 c++ 字符串基础
HDOJ 2072, HDOJ 2081 /**/ #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <iostream> #include <algorithm> #include <map> #i
2018-09-13 14:17:48 148
原创 HDOJ 2044
找规律写出来WA掉了,思前想后找不到原因。 后来,发现数组要是LL的。。。。 用递归就好,第11页上不少这样的题。都是找规律用递归 /**/ #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <iostream> #in...
2018-08-31 21:48:52 182
原创 HDOJ 2035 pow(a,b)后三位
/**/ #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <iostream> #include <algorithm> #include <map> #include <set&
2018-08-31 11:57:58 148
原创 HDOJ 2034 求差集
首先要搞明白差集的定义,A-B的结果是A中有而B中没有的所有元素的集合。 /**/ #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <iostream> #include <algorithm> #includ...
2018-08-31 11:34:56 170
原创 HDOJ 2030 统计汉字个数
/**/ #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <iostream> #include <algorithm> #include <map> #include <set&
2018-08-30 22:34:25 103
原创 HDOJ 2028 求多个数的最小公倍数
这是我的第一篇。。所以写一个近来AC出来最快的题。 见笑。 /**/ #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <iostream> #include <algorithm> #include <m...
2018-08-30 21:19:05 289
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人