HDU 1996 Norwood VI (permutation combination)

Source: Internet
Author: User
Tags cmath

Test instructions: ...

Analysis: Every time there are three kinds of methods, three-3^n, the root pillar, so is the second party.

The code is as follows:

#pragma COMMENT (linker, "/stack:1024000000,1024000000") #include <cstdio> #include <string> #include < cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set> #include < queue> #include <algorithm> #include <vector> #include <map> #include <cctype> #include < cmath> #include <stack> #include <unordered_map> #include <unordered_set> #define DEBUG () puts ("+ + + + "); #define FREOPENR freopen (" In.txt "," R ", stdin) #define FREOPENW freopen (" OUT.txt "," w ", stdout) using namespace std; typedef long Long Ll;typedef pair<int, int> p;const int inf = 0x3f3f3f3f;const double inf = 0x3f3f3f3f3f3f;const Dou ble PI = ACOs ( -1.0); const double EPS = 1e-8;const int maxn = 0 + 5;const int mod = 2000;const int dr[] = {-1, 1,, 0};co NST int dc[] = {0, 0, 1, -1};const char *de[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", " 1001 "," 1010 "," 1011 "," 1100 "," 1101 "," 1110 "," 1111 "};inT n, m;const int mon[] = {0, 31, 29, 31, 30, 31, 30, +, 0,,, +, +, +,. , D, D, 0, D,, 31};inline bool is_in (int r, int c) {return R >=, r < n && C >= 0 &A mp;& c < m;}    LL dp[64];void init () {dp[1] = 3; for (int i = 2; i < ++i) dp[i] = dp[i-1] * 3LL;}    int main () {init ();  int T;    Cin >> T;    while (t--&& cin >> N) cout << dp[n] << Endl; return 0;}

HDU 1996 Norwood VI (permutation combination)

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.