前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ACMSGURU 130 - Circle

ACMSGURU 130 - Circle

作者头像
Reck Zhang
发布2021-08-11 10:13:08
2560
发布2021-08-11 10:13:08
举报
文章被收录于专栏:Reck Zhang

Circle

Problem Description

On a circle border there are 2k different points A1, A2, …, A2k, located contiguously. These points connect k chords so that each of points A1, A2, …, A2k is the end point of one chord. Chords divide the circle into parts. You have to find N - the number of different ways to connect the points so that the circle is broken into minimal possible amount of parts P.

Input

The first line contains the integer k (1 <= k <= 30).

Output

The first line should contain two numbers N and P delimited by space.

Sample Input

2

Sample Output

2 3

Solution

代码语言:javascript
复制
#include <bits/stdc++.h>

int main() {
//    std::vector<unsigned long long> dp(35, 0);
//    dp[1] = 1;
//    dp[2] = 2 * dp[1] * dp[1];
//    for(int i = 3; i <= 30; i++) {
//        dp[i] += 2 * dp[1] * dp[i - 1];
//        for(int j = 1; j <= i - 1; j++) {
//            dp[i] += dp[1] * dp[j] * dp[i - 1 - j];
//        }
//    }
//    for(int i = 1; i <= 30; i++) {
//        std::cout << i << " " << dp[i] << std::endl;
//    }
    std::vector<std::string> dp {
        "0",
        "1",
        "2",
        "5",
        "14",
        "42",
        "132",
        "429",
        "1430",
        "4862",
        "16796",
        "58786",
        "208012",
        "742900",
        "2674440",
        "9694845",
        "35357670",
        "129644790",
        "477638700",
        "1767263190",
        "6564120420",
        "24466267020",
        "91482563640",
        "343059613650",
        "1289904147324",
        "4861946401452",
        "18367353072152",
        "69533550916004",
        "263747951750360",
        "1002242216651368",
        "3814986502092304",
    };
    int k;
    std::cin >> k;
    std::cout << dp[k] << " " << k + 1 << std::endl;
    return 0;
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-09-23,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Circle
    • Problem Description
      • Input
        • Output
          • Sample Input
            • Sample Output
              • Solution
              领券
              问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档