题解 | #牛牛学加法#
牛牛学加法
https://ac.nowcoder.com/acm/problem/21987
灵感来源@limingyang
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
for (int i=0; i<=1000; i++)
{
for (int j=0; j<=1000; j++)
{
if (i==0) s[i][j]=j;
else if (j==0) s[i][j]=i;
else s[i][j]=s[i-1][j-1]+2;
}
}
for (int i=0; i<=1000; i++)
{
for (int j=0; j<=1000; j++)
{
freopen("114514.txt","w",stdout)
}
}
文本文档就崩了
#include <bits/stdc++.h>
using namespace std;
int s[1001][1001];
int a,b;
int main()
{
cin>>a>>b;
for (int i=0; i<=1000; i++)
{
for (int j=0; j<=1000; j++)
{
if (i==0) s[i][j]=j;
else if (j==0) s[i][j]=i;
else s[i][j]=s[i-1][j-1]+2;
}
}
cout<<s[a][b];
return 0;
}