HDU 4472 second point competition I

Source: Internet
Author: User

A tree with N nodes has only one root and the following subnodes are the same.

Question address: Count

/* I have been watching this question during the competition. In fact that what I-1 about the number of the time to write, but did not expect to use DP, and if the I-1 is a prime number, can only add 1 + before one. Then I was trying to determine how it could be split. It's really a question about DP !!! */# Include <iostream> # include <cstdio> using namespace STD; const int mo = (INT) 1e9 + 7; int DP [1002], I, J; int main () {DP [1] = 1; DP [2] = 1; for (I = 3; I <= 1000; I ++) {int T = I-1; for (j = 1; j <I; j ++) if (T % J = 0) {DP [I] + = DP [J]; while (DP [I]> Mo) DP [I]-= Mo ;}} int step = 0, N; while (~ Scanf ("% d", & N) printf ("case % d: % d \ n", ++ step, DP [N]); Return 0 ;}

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.