Code forces 414B very good hands to promote compliance

Source: Internet
Author: User

Http://codeforces.com/problemset/problem/414/B


The topic is quite good. Keep A memorial, a good idea of the topic


#include <iostream> #include <cstdio> #include <list> #include <algorithm> #include <cstring > #include <string> #include <queue> #include <stack> #include <map> #include <vector># include<cmath> #include <memory.h> #include <set> #define LL long long#define EPS 1e-8#define inf 0xfffffffconst ll INF = 1ll<<61;using namespace std;//vector<pair<int,int> > G;//typedef pair<int, int > p;//vector<pair<int,int> >:: Iterator Iter;////map<ll,int >mp;//map<ll,int;:: iterator p; #define MOD 1000000007vector<int> g[2555];int dp[2555][2555];void init () {for (int i=1;i<=2000;i++) for (int j=1;j<=i;j++) if (i%j = = 0) g[i].push_back (j);} int main () {init (); int n,k;scanf ("%d%d", &n,&k), for (int i=1;i<=n;i++) dp[1][i] = 1;for (int i=2;i<=k;i++) { for (int j=1;j<=n;j++) {for (int kk=0;kk<g[j].size (); kk++) {int tmp = G[J][KK];DP [i][j] + = dp[i-1][tmp];DP [i][j]%= M OD;}}} int ans = 0;for (int i=1;i<=n;i++) ans = (ans + dp[k][i])%mod;printf ("%d\n", ans); 


Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

Code forces 414B very good hands to promote compliance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.