标签:blog ar io sp for on div 问题 log
#include<stdio.h> int jCheng[21];//as you like void generateSpecialJCheng(int input){ //!!阶乘存入第k个位置 for(int k = 1; k <= input; ++k){ int summary = 1; for(int s = 1; s <= k; s += 2){ summary *= s; } jCheng[k] = summary; } } int main(){ generateSpecialJCheng(20); int loop_rounds; while(~scanf("%d", &loop_rounds)){ while(loop_rounds--){ int t; unsigned long long total = 0; scanf("%d", &t); for(int i = 1; i <= t; i++){ total += jCheng[i]; } printf("%I64u\n", total); } } return 0; } /* 样例输入 2 3 5 样例输出 5 23 */
标签:blog ar io sp for on div 问题 log
原文地址:http://www.cnblogs.com/wbstackpop/p/4172185.html