摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;int main(){ int t; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); int ans = (1 + n / 2 - 1) * (n / 2 - 1) / 2 * 2; if (n & 1) ans + 阅读全文
posted @ 2013-03-27 16:41 undefined2024 阅读(218) 评论(0) 推荐(0)
摘要: 递推View Code import java.math.BigInteger;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); while (true) { int n, m; m = cin.nextInt(); n = cin.nextInt(); if (n == 0 &... 阅读全文
posted @ 2013-03-27 14:58 undefined2024 阅读(139) 评论(0) 推荐(0)
摘要: 用dp的方法n^2。用树状数组应该是n^2logn。View Code #include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>using namespace std;#define maxn 105int n;int map[maxn][maxn];int row, col;int sx, sy;int f[maxn][maxn];void input(){ memset(map, 0, sizeof(map)); scanf("%d%d" 阅读全文
posted @ 2013-03-27 13:45 undefined2024 阅读(536) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxd 105int n, q;int f[maxd];void input(){ memset(f, 0, sizeof(f)); for (int i = 0; i < n; i++) { int num; scanf("%d", &num); for (int j = 0; j &l 阅读全文
posted @ 2013-03-27 12:16 undefined2024 阅读(264) 评论(0) 推荐(0)