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)