题目链接:https://vjudge.net/contest/125308#problem/B

题意:给定n个三角形,问最多可以把区域化成多少个部分,这是一个一维空间  一定会满足一元二次方程  题目给定1 2的个数 只要得到3的个数就可以用待定系数法求得公式:F(x) = 3*(x-1)*x+2;  另外如果是二维的话,会满足一元三次方程 ,也可以用待定系数法求解;20

AC代码:

 import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer; public class Main {
public static void main(String[] args) {
InputReader s = new InputReader(System.in);
PrintWriter cout = new PrintWriter(System.out);
int t , x,t1;
t = s.nextInt();
while (t-- > ) {
x = s.nextInt();
t1 = *(x-)*x+;
cout.println(t1); }
cout.flush();
}
static int gcd(int a, int b) {
return b == ? a : gcd(b, a % b);
}
}
class InputReader { public BufferedReader rea;
public StringTokenizer tok; public InputReader(InputStream stream) {
rea = new BufferedReader(new InputStreamReader(stream), );
tok = null;
} public String next() {
while (tok == null || !tok.hasMoreTokens()) {
try {
tok = new StringTokenizer(rea.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tok.nextToken();
} public int nextInt() {
return Integer.parseInt(next());
} }
05-07 11:56