2013
11-13

# Equivalent Polynomial

Given a polynomial and a number t, please convert it into an equivalent polynomial in the form of .

The input contains several test cases.
The first line of each test case gives two integer n (1 < n ≤ 200) and t (-10 ≤ t ≤ 10). The following line is a sequence of n integer a0,a1, … ,an (-1000 ≤ ai ≤ 1000), which is separated by exactly one space.

For each test case, output the equivalent polynomial’s coefficient b0,b1, … ,bn. One line for each test case and each number is separated by exactly one space, no extra space at the end of each line.

2 1
1 0 2

3 4 2

import java.math.BigInteger;
import java.io.*;
import java.util.*;

public class Main {
static int n;
static BigInteger t=new BigInteger("1");
static BigInteger c[][] = new BigInteger [210][210];

/**//*
static BigInteger C(int n,int m)
{
if(m==0||m==n)
return BigInteger.ONE;
BigInteger res=new BigInteger("1");
int i;
for(i=n;i>=n-m+1;i--)
res=res.multiply(BigInteger.valueOf(i));
for(i=m;i>=1;i--)
res=res.divide(BigInteger.valueOf(i));
return res;
}
*/

static int a[]=new int[202];
static BigInteger ans[]=new BigInteger [202];

/** *//**
* @param args the command line arguments
*/
public static void main(String[] args) {
for(int i=0;i<=200;i++) c[i][0]=c[i][i]=BigInteger.ONE;
for(int i=2;i<=200;i++)
{
for(int j=1;j< i;j++)
{
}
}
Scanner cin = new Scanner (new BufferedInputStream(System.in));
while(cin.hasNext())
{

n=cin.nextInt();
t=cin.nextBigInteger();
int i,j;
for(i=0;i<=n;i++)
a[i]=cin.nextInt();
for(i=0;i<=n;i++)
ans[i]=BigInteger.ZERO;

for(i=0;i<=n;i++)
for(j=i;j<=n;j++)
if(j-i< i)
else
for(i=0;i< n;i++)
{
System.out.print(ans[i]);
System.out.print(" ");
}
System.out.println(ans[n]);

/**//*
String res=new String ("");
for(i=0;i< n;i++)
{
res+=ans[i].toString();
res+=" ";
}
res+=ans[n].toString();
System.out.print(res);
System.out.println();
* */

}

}
}

1. 您没有考虑 树的根节点是负数的情况， 若树的根节点是个很大的负数，那么就要考虑过不过另外一边子树了

2. 第一句可以忽略不计了吧。从第二句开始分析，说明这个花色下的所有牌都会在其它里面出现，那么还剩下♠️和♦️。第三句，可以排除2和7，因为在两种花色里有。现在是第四句，因为♠️还剩下多个，只有是♦️B才能知道答案。