最开始有一个禽兽得了传染病,一个禽兽会每轮传染x个禽兽。
试问n轮传染后有多少禽兽被传染?
输入
一行,包含两个正整数n,x(1<=n,x<=30)
输出
一行,一个整数表示答案,答案保证不超过int范围
输入
2 10
输出
121
if(n=1) s=x+1,
if(n=2) s=(x+1)*x+(x+1)=pow(x+1,2)
#include <iostream>
#include <string.h>
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
int n,x;
cin>>n>>x;
int s=0;
for(int i=1;i<=n;i++)
{
s=pow(x+1,n);
}
printf("%d\n",s);
}