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) 编辑
摘要: 首先有以下性质:(p 为素数) 1. φ(p)=p-1 2. 如果i mod p==0,那么φ( i*p )=p*φ( i ) 3. 若i mod p≠0,那么φ(i*p)=φ(i)*(p-1)证明见http://blog.csdn.net/Lytning/article/deta... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(104) 评论(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) 编辑
摘要: #include#include#include#include#include#includeusing namespace std;int n;int ans[10];int a1[]={0,31,28,31,30,31,30,31,31,30,31,30,31};int a2[... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(79) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problem/show?pid=1201#sub注意的问题:送出去的钱是整数!#include#include#include#include#include#include#include using namespace std;int... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 纪念一下,这是我自己第一个自己想出转移方程的dp题! 先定义一下数组,f[i][j]表示第i个人,抄了j本书花的最短时间。 w[i][j]表示[i,j]闭区间内,从第i本书抄到第j本书用的时间; 转移方程:f[h][i]=min(f[h][i],max(f[h-1][j],w... 阅读全文
posted @ 2017-09-24 17:48 primes 阅读(120) 评论(0) 推荐(0) 编辑