您的位置:首页 > 其它

hdu 2045 不容易系列之(3)—— LELE的RPG难题

2016-05-24 17:10 260 查看
Posted by cds
at 2016-02-12 21:19:16 on Problem 2045


(1) 

对于cds总结的

环形数n用m颜料涂种类数:(m-1)^n + (m-1)*(-1)^n

可以当作公式来记忆了


#include<stdio.h>//环形数n用m颜料涂种类数:(m-1)^n + (m-1)*(-1)^n
#include<math.h>
int main()
{
int n;
long long cnt;
while(scanf("%d", &n) != EOF)
{
if(n == 1)
cnt = 3;
else
cnt = pow(2, n) + 2*pow(-1, n);
printf("%lld\n", cnt);
}

return 0;
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: