Fork me on GitHub
摘要: [题目链接](https://share.weiyun.com/9b72b3b07a3b1d8f221bf7f1dd554985) T1 60分可以写一些特判和暴力。 100分dp,解释一下dp的做法。 我们用f[i][j]表示跳了i次,到第j层楼然后跳下去,需要的最小花费。 还需要知道一个策略,如果跳过的楼是一样的,那么以高度升序或者降序肯定比乱跳更优。 那么我们先将所有的楼按照高度升序或者... 阅读全文
posted @ 2017-10-30 16:37 primes 阅读(172) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problem/show?pid=3383#sub#include#include#include#include#include#include#include#define L long#define M 200000007using ... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(108) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problem/show?pid=3518问题描述: 有一个密码箱,0 到 n-1中的某些整数是它的密码,且满足:如果a和b都是它的密码,那么(a+b)%n 也是它的密码(a,b可以相等)某人试了k次密码,前k-1次都失败了,第k次成功了。... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(133) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3292如果一个数 i 是 H-素数,那么5i+4i*x一定是H数但不是H-素数, 因为(5i+4i*x)mod 4=5i mod 4=(5 mod 4)(i mod 4)=1*1=1,且5i+4i*x=i(4x+5).做法:先找出... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(58) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problem/show?pid=1052 观察数据,L到10^9,就是O(n)也不可以。 然后再观察数据,发现共才100个石子,对于桥的长度来说石子非常稀疏,中间有一大块空白区域。 状态转移方程: f[i]=min(f[i],f[i-... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(136) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problem/show?pid=1215#sub 暴力模拟多种情况。我是用搜索写的,注意返回条件和约束条件。#include#include#include#include#includeusing namespace std;int a... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(134) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problem/show?pid=1214#sub 暴力枚举题,加上一些剪枝。 (原谅我卑劣地提交了两个答案特判)#include#include#include#include#includeusing namespace std;int... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(103) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problem/show?pid=1207#sub 练好基本功 进制转换#include#include#include#include#includeusing namespace std;int n,s,a[1000],t,ans[10... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(133) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problem/show?pid=1217#sub 首先,四位的,六位的,八位的回文数一定不是质数,因为它们都是11的倍数。 此题无需打表质数,因为回文数(应该)比质数少。 枚举回文数,举例五位的:for(int d1=1;d1#inclu... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(308) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problem/show?pid=1205大大大大大大枚举! 通过纸上画图来找各个情况中点与点的对应坐标关系。 还需要注意的问题:题目要求序号尽量靠前。#include#include#include#include#include#inc... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(93) 评论(0) 推荐(0) 编辑