emm…介个t是什么?
by Adorable_ @ 2023-11-22 14:53:40
emm问题就是……
每次增加的数量可以先存起来再乘x,如果不这样的话乘完x之后再加就不是原来那个数啦~
```cpp
#include<iostream>
using namespace std;
int main()
{
long long x,n,w=1,t;
cin>>x>>n;
for(int i=0;i<n;i++)
{
t=w;
w*=x;
w+=t;
// w+=x;
}
cout<<w+1;
return 0;
}
```
(求个关注谢谢啦)
by Adorable_ @ 2023-11-22 14:58:55
@[Adorable_](/user/1002517) 啊啊当然for那里写
for(int i = 1;i<=n;i++)
也可以,只是我习惯i=1;i<n
by Adorable_ @ 2023-11-22 15:00:41