Xmd123456 @ 2023-04-09 01:00:33
#include<bits/stdc++.h>
using namespace std;
string to_upper(string s){
for (int i = 0; i < s.length(); i++)
if ('a' <= s[i] && s[i] <= 'z')
s[i] -= 'a' - 'A';
return s;
}
int main() {
int N;
cin >> N;
string s[5005], s1, s2;
getline (cin, s1);
s2 = to_upper (s1);
for (int i = 1; i <= N; i++)
s[i] = s[i - 2] + s[i - 1];
cout << s[N];
return 0;
}v
by z_scar @ 2023-04-09 09:45:23
你最后一行的“v”是什么? (下面附上我的代码)
#include<bits/stdc++.h>
using namespace std;
int n,m[5010][5010],z;
int main()
{
cin>>n;
z=1;
m[1][1]=1;
m[2][1]=2;
for(int i=3;i<=n;i++)
{
for(int j=1;j<=z;j++) m[i][j]=m[i-1][j]+m[i-2][j];
for(int j=1;j<=z;j++)
{
if(m[i][j]>=10)
{
m[i][j+1]+=m[i][j]/10;
m[i][j]%=10;
if(m[i][z+1]>0)z++;
}
}
}
for(int i=z;i>=1;i--) cout<<m[n][i];
return 0;
}
by Xmd123456 @ 2023-04-22 13:11:41
@xzydsb 感谢