这场比赛打得我想退役了.一个队伍合理的情况是1+1+1 > 3,而我们队的情况则是1+ 1 + 1 < 1.完全变成单挑队...
并不想对自己的队伍做太多差的评价,可这场比赛比的自己火气很大.
选择保研,我很想在干一年.可是,我想在干一年是想去拿金牌!如果最终也只是银牌,那就没有必要去在搞.如果有冲金的实力,我也会去拼的...shangke今年也要退役了...尽管自己实力还不够,但12级的实力也着实让我有点伤感...唉...
1004 KM算法,唉,这道题也还要自己来做
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | /************************************************************************* > File Name: 1004.cpp > Author: skt > Mail: sktsxy@gmail.com > Created Time: 2014年09月27日 星期六 13时43分55秒 ************************************************************************/ #include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <queue> #include <bitset> #include <algorithm> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <memory.h> #include <cassert> // #pragma comment(linker,"/STACK:102400000,102400000") using namespace std; #define LL long long #define pb push_back #define mp make_pair #define PI acos(-1.0) #define eps 1e-8 #define x first #define y second template <typename T> inline T Max(T a, T b) {return a>b?a:b;} template <typename T> inline T Min(T a, T b) {return a<b?a:b;} typedef pair<int, int> PII; typedef vector<int> vi; int T, N, M, Cas = 1; #define MAXN 105 const int INF = 0x3fffffff; int nx, ny, match; int fx[MAXN], fy[MAXN], sx[MAXN], sy[MAXN]; double lx[MAXN], ly[MAXN], slack[MAXN], g[MAXN][MAXN]; double a[15][MAXN * 20]; int path(int u) { sx[u] = 1; for (int v = 1; v <= ny; v ++) { if (sy[v]) continue; if (fabs(g[u][v] - lx[u] - ly[v]) <= eps) { sy[v] = 1; if (!fy[v] || path(fy[v])) { fx[u] = v; fy[v] = u; return 1; } } else { slack[v] = (slack[v] < (lx[u] + ly[v] - g[u][v])) ? slack[v] : (lx[u] + ly[v] - g[u][v]); } } return 0; } double KuhnMunkres() { double match = 0; memset(lx, 0, sizeof(lx)); memset(ly, 0, sizeof(ly)); memset(fx, 0, sizeof(fx)); memset(fy, 0, sizeof(fy)); for (int i = 1; i <= nx; i ++) { lx[i] = - INF; for (int j = 1; j <= ny; j ++) { lx[i] = (lx[i] < g[i][j]) ? g[i][j] : lx[i]; } } for (int i = 1; i <= nx; i ++) { for (int j = 1; j <= ny; j ++) slack[j] = INF; if (!fx[i]) { memset(sx, 0, sizeof(sx)); memset(sy, 0, sizeof(sy)); while (!path(i)) { double p = 1e10; for (int j = 1; j <= ny; j ++) { if (!sy[j] && p > slack[j]) p = slack[j]; } for (int j = 1; j <= nx; j ++) if (sx[j]) lx[j] -= p, sx[j] = 0; for (int j = 1; j <= ny; j ++) if (sy[j]) ly[j] += p, sy[j] = 0; } } } for (int i = 1; i <= ny; i ++) { match += g[fy[i]][i]; } return match; } void work() { memset(a, 0, sizeof(a)); scanf("%d %d", &N, &M); for (int i = 1; i <= N; i ++) { for (int j = 1; j <= M; j ++) { scanf("%lf", &a[i][j]); } } double ans = 0; for (int i = 0; i <= (M / N) + 1; i ++) { for (int j = 1; j <= N; j ++) { for (int k = 1; k <= N; k ++) { g[j][k] = a[j][i * N + k]; } } nx = ny = N; ans = ans + KuhnMunkres(); } printf("Case #%d: %.5lf\n", Cas ++, ans); } int main() { scanf("%d", &T); while (T --) { work(); } return 0; } |
1006 找规律
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Scanner; /** * @author: skt E-mail:sktsxy@gmai.com * @Create:Sep 27, 2014 2:22:23 PM * @filename: Main.java */ public class Main { static int T, Cas = 1; static long N; public static void work(Scanner in, PrintWriter out) { N = in.nextLong(); BigInteger ans = BigInteger.ONE; BigInteger a = BigInteger.valueOf(N); ans = ans.subtract(a.multiply(BigInteger.valueOf(7l))); a = a.multiply(a); ans = ans.add(a.multiply(BigInteger.valueOf(8l))); out.println("Case #" + Cas + ": " + ans); Cas ++; } public static void main(String[] args) throws FileNotFoundException { // System.setIn(new FileInputStream(new File("src/in"))); Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); T = in.nextInt(); while (T -- != 0) { work(in, out); } in.close(); out.close(); } } |
1009 逗比得去按照网上的二进制gcd方程
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | /************************************************************************* > File Name: 1009.cpp > Author: skt > Mail: sktsxy@gmail.com > Created Time: 2014年09月27日 星期六 12时15分55秒 ************************************************************************/ #include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <queue> #include <bitset> #include <algorithm> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <memory.h> #include <cassert> #pragma comment(linker,"/STACK:102400000,102400000") using namespace std; #define LL long long #define pb push_back #define mp make_pair #define PI acos(-1.0) #define eps 1e-8 #define x first #define y second #define MAXN 1005 template <typename T> inline T Max(T a, T b) {return a>b?a:b;} template <typename T> inline T Min(T a, T b) {return a<b?a:b;} typedef pair<int, int> PII; typedef vector<int> vi; int T, Cas = 1; string a, b; vector <int> ans; bool zero(bitset<MAXN> now) { for (int i = 0; i < now.size(); i ++) { if (now.test(i)) { return false; } } return true; } bool cmp(bitset<MAXN> a, bitset<MAXN> b) { for (int i = MAXN - 1; i >= 0; i --) { if (a.test(i) && !b.test(i)) { return true; } if (!a.test(i) && b.test(i)) { return false; } } return true; } bitset<MAXN> sub(bitset<MAXN> a, bitset<MAXN> b) { bitset<MAXN> now; int div = 0; for (int i = 0; i < MAXN; i ++) { int x = a[i] - b[i] + div; if (x < 0) { x += 2; div = -1; } else { div = 0; } now[i] = x; } return now; } void gcd(bitset<MAXN> a, bitset<MAXN> b) { if (zero(a)) { for (int i = 0; i < b.size(); i ++) { ans.pb(b[i]); } return ; } else { if (!a.test(0) && !b.test(0)) { ans.pb(0); gcd(a >> 1, b >> 1); } else { if ((a.test(0) && !b.test(0)) || (!a.test(0) && b.test(0))) { if (a.test(0) && !b.test(0)) { gcd(a, b >> 1); } else { gcd(b, a >> 1); } } else { if (cmp(a, b)) { gcd(sub(a, b), b); } else { gcd(sub(b, a), b); } } } } } void work() { printf("Case #%d: ", Cas ++); cin >> a; cin >> b; ans.clear(); bitset<MAXN> b1(a), b2(b); gcd(b1, b2); reverse(ans.begin(), ans.end()); int flag = 0; for (int i = 0; i < ans.size(); i ++) { if (ans[i]) { flag = i; break; } } for (int i = flag; i < ans.size(); i ++) { printf("%d", ans[i]); } printf("\n"); } int main() { scanf("%d", &T); while (T --) { work(); } return 0; } |
1012 水题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | /************************************************************************* > File Name: 1012.cpp > Author: skt > Mail: sktsxy@gmail.com > Created Time: 2014年09月27日 星期六 12时02分37秒 ************************************************************************/ #include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <queue> #include <bitset> #include <algorithm> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <memory.h> #include <cassert> // #pragma comment(linker,"/STACK:102400000,102400000") using namespace std; #define LL long long #define pb push_back #define mp make_pair #define PI acos(-1.0) #define eps 1e-8 #define x first #define y second #define MAXN 10005 template <typename T> inline T Max(T a, T b) {return a>b?a:b;} template <typename T> inline T Min(T a, T b) {return a<b?a:b;} typedef pair<int, int> PII; typedef vector<int> vi; int T; LL A, B, sum[MAXN] = {}, Cas = 1; LL calc(LL x) { return x * (x + 1) * (2 * x + 1) / 6; } void init() { sum[0] = 0; for (LL i = 1; i <= 10000; i ++) { sum[i] = sum[i - 1] + i * i * i; } } void work() { cin >> A >> B; cout << "Case #" << Cas ++ << ": " << (sum[B] - sum[A - 1]) << endl; } int main() { ios::sync_with_stdio(false); init(); cin >> T; while (T --) { work(); } return 0; } |