摘要: #include "bits/stdc++.h" using namespace std; #define LL long long #define INF 0x3f3f3f3f3f #define PI acos(-1) #define N 510 #define MOD 10 using namespace std; int arr[N+1][N+1],dp[N+1][N+1]... 阅读全文
posted @ 2017-08-31 23:46 kimsimple 阅读(226) 评论(0) 推荐(0) 编辑
摘要: Input示例 Output示例 阅读全文
posted @ 2017-08-31 23:33 kimsimple 阅读(177) 评论(0) 推荐(0) 编辑
摘要: #include "bits/stdc++.h" using namespace std; #define LL long long #define INF 0x3f3f3f3f3f #define PI acos(-1) #define N 1000000 #define MOD 10 int main() { int n; while(~scanf("%d... 阅读全文
posted @ 2017-08-31 23:10 kimsimple 阅读(164) 评论(0) 推荐(0) 编辑
摘要: #include #include "iostream" using namespace std; int main() { int m; int a[10]={0}; cin>>m; for(int i=m;;i++){ int n=i,len=0,sum=0; while(n!=0) { ... 阅读全文
posted @ 2017-08-31 22:50 kimsimple 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 题意: 小于等于n的所有数中1的出现次数 分析: 数位DP 预处理dp[i][j]存 从1~以j开头的i位数中有几个1,那么转移方程为: if(j == 1) dp[i][j] = dp[i-1][9]*2+pow(10,i-1);else dp[i][j] = dp[i-1][9]+dp[i][j 阅读全文
posted @ 2017-08-31 22:27 kimsimple 阅读(568) 评论(0) 推荐(0) 编辑
摘要: #include "bits/stdc++.h" using namespace std; #define LL long long #define INF 0x3f3f3f3f3f #define PI acos(-1) #define N 510 #define MOD 10 LL quickPow(LL a,LL b) { LL ans=1; while(b>0){ ... 阅读全文
posted @ 2017-08-31 22:08 kimsimple 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题意:n的阶乘后面0的个数,如果直接算出阶乘再数0的数量一定会超时的。 因为10=2*5,所以求出5贡献的次数就行。 阅读全文
posted @ 2017-08-31 21:51 kimsimple 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Input示例 Output示例 DP: 递推式: 阅读全文
posted @ 2017-08-31 20:32 kimsimple 阅读(142) 评论(0) 推荐(0) 编辑
摘要: Input示例 Output示例 first try: O(n^2) Time limit exceeded,优化 second try: 第二层从后向前找,及时跳出 #include "bits/stdc++.h" using namespace std; #define LL long long 阅读全文
posted @ 2017-08-31 20:21 kimsimple 阅读(437) 评论(0) 推荐(0) 编辑