1002: [FJOI2007]轮状病毒
Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 5373 Solved: 2924
[ Submit][ Status][ Discuss]
Description
轮状病毒有很多变种,所有轮状病毒的变种都是从一个轮状基产生的。一个N轮状基由圆环上N个不同的基原子和圆心处一个核原子构成的,2个原子之间的边表示这2个原子之间的信息通道。如下图所示
![](http://www.lydsy.com/JudgeOnline/upload/201604/1%283%29.png)
N轮状病毒的产生规律是在一个N轮状基中删去若干条边,使得各原子之间有唯一的信息通道,例如共有16个不同的3轮状病毒,如下图所示
![](http://www.lydsy.com/JudgeOnline/upload/201604/2%283%29.png)
现给定n(N<=100),编程计算有多少个不同的n轮状病毒
Input
第一行有1个正整数n
Output
计算出的不同的n轮状病毒数输出
Sample Input
3
Sample Output
16
爆搜打表
也可以找出规律:F[n] = 3*F[n-1]-F[n-2]+2
#include<stdio.h>
int main(void)
{
int n;
while(scanf("%d", &n)!=EOF)
{
switch(n)
{
case 1: printf("1\n"); break;
case 2: printf("5\n"); break;
case 3: printf("16\n"); break;
case 4: printf("45\n"); break;
case 5: printf("121\n"); break;
case 6: printf("320\n"); break;
case 7: printf("841\n"); break;
case 8: printf("2205\n"); break;
case 9: printf("5776\n"); break;
case 10: printf("15125\n"); break;
case 11: printf("39601\n"); break;
case 12: printf("103680\n"); break;
case 13: printf("271441\n"); break;
case 14: printf("710645\n"); break;
case 15: printf("1860496\n"); break;
case 16: printf("4870845\n"); break;
case 17: printf("12752041\n"); break;
case 18: printf("33385280\n"); break;
case 19: printf("87403801\n"); break;
case 20: printf("228826125\n"); break;
case 21: printf("599074576\n"); break;
case 22: printf("1568397605\n"); break;
case 23: printf("4106118241\n"); break;
case 24: printf("10749957120\n"); break;
case 25: printf("28143753121\n"); break;
case 26: printf("73681302245\n"); break;
case 27: printf("192900153616\n"); break;
case 28: printf("505019158605\n"); break;
case 29: printf("1322157322201\n"); break;
case 30: printf("3461452808000\n"); break;
case 31: printf("9062201101801\n"); break;
case 32: printf("23725150497405\n"); break;
case 33: printf("62113250390416\n"); break;
case 34: printf("162614600673845\n"); break;
case 35: printf("425730551631121\n"); break;
case 36: printf("1114577054219520\n"); break;
case 37: printf("2918000611027441\n"); break;
case 38: printf("7639424778862805\n"); break;
case 39: printf("20000273725560976\n"); break;
case 40: printf("52361396397820125\n"); break;
case 41: printf("137083915467899401\n"); break;
case 42: printf("358890350005878080\n"); break;
case 43: printf("939587134549734841\n"); break;
case 44: printf("2459871053643326445\n"); break;
case 45: printf("6440026026380244496\n"); break;
case 46: printf("16860207025497407045\n"); break;
case 47: printf("44140595050111976641\n"); break;
case 48: printf("115561578124838522880\n"); break;
case 49: printf("302544139324403592001\n"); break;
case 50: printf("792070839848372253125\n"); break;
case 51: printf("2073668380220713167376\n"); break;
case 52: printf("5428934300813767249005\n"); break;
case 53: printf("14213134522220588579641\n"); break;
case 54: printf("37210469265847998489920\n"); break;
case 55: printf("97418273275323406890121\n"); break;
case 56: printf("255044350560122222180445\n"); break;
case 57: printf("667714778405043259651216\n"); break;
case 58: printf("1748099984655007556773205\n"); break;
case 59: printf("4576585175559979410668401\n"); break;
case 60: printf("11981655542024930675232000\n"); break;
case 61: printf("31368381450514812615027601\n"); break;
case 62: printf("82123488809519507169850805\n"); break;
case 63: printf("215002084978043708894524816\n"); break;
case 64: printf("562882766124611619513723645\n"); break;
case 65: printf("1473646213395791149646646121\n"); break;
case 66: printf("3858055874062761829426214720\n"); break;
case 67: printf("10100521408792494338631998041\n"); break;
case 68: printf("26443508352314721186469779405\n"); break;
case 69: printf("69230003648151669220777340176\n"); break;
case 70: printf("181246502592140286475862241125\n"); break;
case 71: printf("474509504128269190206809383201\n"); break;
case 72: printf("1242282009792667284144565908480\n"); break;
case 73: printf("3252336525249732662226888342241\n"); break;
case 74: printf("8514727565956530702536099118245\n"); break;
case 75: printf("22291846172619859445381409012496\n"); break;
case 76: printf("58360810951903047633608127919245\n"); break;
case 77: printf("152790586683089283455442974745241\n"); break;
case 78: printf("400010949097364802732720796316480\n"); break;
case 79: printf("1047242260609005124742719414204201\n"); break;
case 80: printf("2741715832729650571495437446296125\n"); break;
case 81: printf("7177905237579946589743592924684176\n"); break;
case 82: printf("18791999880010189197735341327756405\n"); break;
case 83: printf("49198094402450621003462431058585041\n"); break;
case 84: printf("128802283327341673812651951847998720\n"); break;
case 85: printf("337208755579574400434493424485411121\n"); break;
case 86: printf("882823983411381527490828321608234645\n"); break;
case 87: printf("2311263194654570182037991540339292816\n"); break;
case 88: printf("6050965600552329018623146299409643805\n"); break;
case 89: printf("15841633607002416873831447357889638601\n"); break;
case 90: printf("41473935220454921602871195774259272000\n"); break;
case 91: printf("108580172054362347934782139964888177401\n"); break;
case 92: printf("284266580942632122201475224120405260205\n"); break;
case 93: printf("744219570773534018669643532396327603216\n"); break;
case 94: printf("1948392131377969933807455373068577549445\n"); break;
case 95: printf("5100956823360375782752722586809405045121\n"); break;
case 96: printf("13354478338703157414450712387359637585920\n"); break;
case 97: printf("34962478192749096460599414575269507712641\n"); break;
case 98: printf("91532956239544131967347531338448885552005\n"); break;
case 99: printf("239636390525883299441443179440077148943376\n"); break;
case 100: printf("627376215338105766356982006981782561278125\n"); break;
}
}
return 0;
}