problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::coun_vowels_permutation::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static int countVowelPermutation (int n)
 

详细描述

在文件 leetcode.h512 行定义.

成员函数说明

◆ countVowelPermutation()

int leetcode::coun_vowels_permutation::Solution::countVowelPermutation ( int  n)
static

a-0 e-1 i-2 o-3 u-4

在文件 leetcode.cpp1122 行定义.

1122 {
1124 unsigned long long end[5] = {1, 1, 1, 1, 1};
1125 for(int _i = 1; _i < n; _i++) {
1126 const unsigned long long a = (end[1] + end[2] + end[4]) % 1000000007;
1127 const unsigned long long e = (end[0] + end[2]) % 1000000007;
1128 const unsigned long long i = (end[1] + end[3]) % 1000000007;
1129 const unsigned long long o = end[2] % 1000000007;
1130 const unsigned long long u = (end[2] + end[3]) % 1000000007;
1131 end[0] = a;
1132 end[1] = e;
1133 end[2] = i;
1134 end[3] = o;
1135 end[4] = u;
1136 }
1137 return (end[0] + end[1] + end[2] + end[3] + end[4]) % 1000000007;
1138 }

被这些函数引用 leetcode::coun_vowels_permutation::TEST().


该类的文档由以下文件生成: