1
#include
<iostream>
2
using
namespace std;
3
int dp[
21][
21];
4
void dpf()
5 {
6
for(
int i=
0;i<
21;i++)
7 dp[i][
0]=
1;
8
for(
int i=
1;i<
21;i++)
9
for(
int j=
1;j<=i;j++)
10 dp[i][j]=dp[i-
1][j-
1]+dp[i-
1][j];
11
12 }
13
int main()
14 {
15 dpf();
16
int n,m;
17 cin>>n>>m;
18
while(n!=-
1)
19 {
20
if(dp[n+m][n]==m+n)
21 cout<<n<<
"+"<<m<<
"="<<m+n<<endl;
22
else
23 cout<<n<<
"+"<<m<<
"!="<<m+n<<endl;
24 cin>>n>>m;
25 }
26 }
转载于:https://www.cnblogs.com/congzc/archive/2011/05/12/2329968.html