- 博客(59)
- 资源 (2)
- 收藏
- 关注
原创 UVa 10041 Vito's Family (median selection)
/* File: 10041.cpp Author: ACboy Date: 2010-3-31 Result: AC Descripition: UVa 10041 Vitos Family (median selection)*/#include #include using namespace std;int data[30100];
2010-03-31 21:09:00 1022
原创 UVa 10132 - File Fragmentation
/* File: 10132.cpp Author: ACboy Date: 2010-3-31 Result: 1A Descripition: UVa 10132 - File Fragmentation*/#include using namespace std;char data[150][260];int cmp(const void
2010-03-31 13:36:00 2364 5
原创 UVa 850 Crypt Kicker II
/* File: 850.cpp Author: ACboy Date: 2010-3-30 Result: AC Descripition: UVa 850 Crypt Kicker II */#include using namespace std;char s[] = "the quick brown fox jumps over the lazy
2010-03-31 11:51:00 2239
原创 UVa 10188 Automated Judge Script
这题我做了4个多小时,太囧了。/* File: 10188.cpp Author: ACboy Date: 2010-3-30 Result: AC Descripition: UVa 10188 Automated Judge Script*/#include #include#include#include#includeusing
2010-03-30 22:10:00 1323
原创 UVa 10252 Common Permutation
/* File: 10252.cpp Author: ACboy Date: 2010-3-29 Result: 1A Descripition: UVa 10252 Common Permutation*/#include #include using namespace std;int main(){#ifndef ONLINE_JUDG
2010-03-30 14:29:00 967
原创 UVa 10082 WERTYU
/* File: 10082.cpp Author: ACboy Date: 2010-3-29 Result: AC Descripition: UVa 10082 WERTYU*/#include int main(){ #ifndef ONLINE_JUDGE freopen("10082.txt", "r", stdin);#en
2010-03-30 14:25:00 1581
原创 UVa 193 - Graph Coloring(graph theory, brute force, backtracking, NP-complete, maximum independent set.)
最近为感情问题纠结了很久,好久没AC了,早上起来回味了一下AC的感觉。哈哈/* File: vc193.cpp Author: ACboy Date: 2010-3-29 Result: AC Description: UVa 193 - Graph Coloring*/#include using namespace std;int data[11
2010-03-29 09:34:00 1897
原创 UVa 140 - Bandwidth
/* File: 140.cpp Author: ACboy Date: 2010-3-25 Result: 1A Description: UVa 140 - Bandwidth*/#include #include using namespace std;int data[80][80];int vis[30];int getMax(
2010-03-25 21:05:00 1609 2
原创 UVa 167 - The Sultan's Successors(2)
/* File: 167.cpp Author: ACboy Date: 2010-3-25 Result: 1A Description: UVa 167 - The Sultans Successors*/#include using namespace std;int data[10][10];int viscolumn[10];int
2010-03-25 19:58:00 1265
原创 UVa 167 - The Sultan's Successors
好几天没AC了,晚上AC一下找找感觉,本题是八皇后问题的变种。/* File: 167.cpp Author: ACboy Date: 2010-3-25 Result: 1A Description: UVa 167 - The Sultans Successors*/#include using namespace std;struct Ans
2010-03-25 19:43:00 1366
原创 UVa 10310 Dog and Gopher(double)
/* coder: ACboy date: 2010-3-21 result: AC description: UVa 10310 Dog and Gopher*/#include #include using namespace std;#define EPS 1e-6struct Point { double x; double y;
2010-03-21 12:53:00 1027
原创 UVa 10310 Dog and Gopher(long long)
/* coder: ACboy date: 2010-3-21 result: AC description: UVa 10310 Dog and Gopher*/#include #include using namespace std;struct Point { long long x; long long y;};Point
2010-03-21 12:38:00 936
原创 UVa 539 The Settlers of Catan
/* coder: ACboy date: 2010-3-19 result: AC description: UVa 539 The Settlers of Catan*/#include using namespace std;int edges[30][30];int vis[30][30];int v[30];int c;int be
2010-03-19 22:05:00 696
原创 UVa 639 Don't Get Rooked
/* coder: ACboy date: 2010-3-19 result: 1A description: UVa 639 Dont Get Rooked*/#include using namespace std;char chess[4][4];char tempChess[4][4];int everyPos[70000][16];i
2010-03-19 19:53:00 970
原创 UVa 216 Getting in Line(回溯版)
/* coder: ACboy date: 2010-3-19 result: AC description: UVa 216 Getting in Line*/#include #include using namespace std;struct node { double x; double y;};struct Ans {
2010-03-19 16:16:00 869
原创 UVa 216 Getting in Line
旅行商TSP(traveling salesmen problem)是一个NP难问题,至今没有有效的解决方案。本问题的规模为8!= 40320种可能,故使用枚举解决,这里枚举通过使用STL的next_permutation()函数来实现。AC代码如下:/* coder: ACboy date: 2010-3-19 result: AC description: UVa 216
2010-03-19 15:19:00 1301
原创 UVa 729 The Hamming Distance Problem
Brute force + backtracking/* coder: ACboy date: 2010-3-19 result: 1A description: UVa 729 The Hamming Distance Problem*/#include using namespace std;// 用于保存所有生产的结果char data[130
2010-03-19 12:15:00 1020
原创 UVa 10098 Generating Fast
STL的next_permutation()求全排列/* coder: ACboy date: 2010-3-19 result: 1A description: UVa 10098 Generating Fast*/#include #include using namespace std;int main(){ int n; char
2010-03-19 09:23:00 905
原创 UVa 146 ID Codes
STL中的next_permutation()下一个排列的简单应用/* coder: ACboy date: 2010-3-19 result: AC description: UVa 146 ID Codes*/#include #include using namespace std; int main() {
2010-03-19 09:11:00 948
原创 UVa 131 The Psychic Poker Player
枚举子集+恶心的模拟/* coder: ACboy date: 2010-3-18 result: 1A description: UVa 131 The Psychic Poker Player*/#include using namespace std;struct cards { int value; char a; char type
2010-03-18 22:47:00 1514
原创 UVa 11205 The broken pedometer
子集枚举,很黄很暴力/* coder: ACboy date: 2010-3-18 result: AC description: UVa 11205 The broken pedometer*/#include using namespace std;char data[110][20];char temp[110][20];int a[40
2010-03-18 19:52:00 1141
原创 UVa 11218 KTV
/* coder: ACboy date: 2010-3-17 result: AC description: UVa 11218 KTV*/#include using namespace std;struct node{ int d[3]; int score;};int evPosb[85000][4];node dat
2010-03-17 22:29:00 1006
原创 UVa 10167 - Birthday Cake
这题很黄很暴力/* coder: ACboy date: 2010-3-17 result: AC desecription: UVa 10167 - Birthday Cake*/#include using namespace std;struct TPoint{ int x; int y;};TPoint data[110];
2010-03-17 21:23:00 1090
原创 UVa 784 Maze Exploration
/* coder: ACboy date: 2010-3-16 result: 1A description: UVa 784 Maze Exploration*/#include using namespace std;char data[40][90];int vis[40][90];int dx[] = {0, 0, 1, 1, -1, -
2010-03-16 20:31:00 1161
原创 UVa 657 The die is cast
/* coder: ACboy date: 2010-3-16 result: AC description: UVa 657 The die is cast*/#include #include using namespace std;int data[100][100];int temp[100][100];int vis[100][100]
2010-03-16 15:26:00 1058
原创 UVa 572 Oil Deposits (非递归版)
/* coder: ACboy date: 2010-3-16 result: 1A description: UVa 572 Oil Deposits*/#include using namespace std;int m, n;int data[256][256];int vis[256][256];int dx[] = {1, 0, -
2010-03-16 14:10:00 621
原创 UVa 572 Oil Deposits (递归版)
/* coder: ACboy date:2010-3-16 result: 1A description: UVa 572 Oil Deposits*/#include using namespace std;int m, n;int data[256][256];int vis[256][256];int dx[] = {0, 1,
2010-03-16 12:44:00 684
原创 UVa 327 Evaluating Simple C Expressions
/* coder: ACboy date: 2010-3-14 result: 1A description: UVa 327 Evaluating Simple C Expressions*/#include #include using namespace std;struct Node { char name; int value; i
2010-03-14 18:53:00 1222
原创 UVa 712 S-Trees
好几天没做题了,都快退化了,早上刚1A了一题。/* coder: ACboy date: 2010-3-13 result: 1A description: UVa 712 S-Trees*/#include #include #include using namespace std;struct Node { struct Node * l
2010-03-14 10:49:00 1116
原创 UVa 548 Tree
/* coder: ACboy date: 2010-3-9 result: 1A description: UVa 548 Tree*/#include #include #include #include #include using namespace std;struct tree { // 左右子树 struct tree
2010-03-09 09:02:00 1050
原创 UVa 540 Team Queue
在该题中使用了二维队列从而实现了不管是入队列还是出队列都是在O(1)的时间内完成,还有关键的一点是使用TeamVis数组来标记那些队已经进入了总队列,从而免去了每次遍历队号队列的操作。/* coder: ACboy date: 2010-3-7 result: 1A description: UVa 540 Team Queue*/#include #inclu
2010-03-07 20:44:00 1759
原创 UVa 11234 Expressions
为了解决本题,我综合使用到了队列、栈和二叉树。/* coder: ACboy date: 2010-3-7 result: AC description: UVa 11234 Expressions */#include #include using namespace std;struct tree{ tree* rchild; tre
2010-03-07 19:52:00 1170
原创 UVa 442 Matrix Chain Multiplication
/* coder: ACboy date: 2010-3-7 result: AC description: UVa 442 Matrix Chain Multiplication*/#include #include #include using namespace std;struct matrix{ char name; int row
2010-03-07 13:29:00 766
原创 UVa 673 Parentheses Balance(2)
/* coder:ACboy date: 2010-3-7 result: AC description: UVa 673 Parentheses Balance*/#include using namespace std;char stack[128];int top;// 匹配两个字符int match(char & a, char &
2010-03-07 09:53:00 1015
原创 UVa 673 Parentheses Balance
/* coder:ACboy date: 2010-3-7 result: AC description: UVa 673 Parentheses Balance*/#include using namespace std;char stack[128];int top;int match(char & a, char & b) { if
2010-03-07 09:43:00 938
原创 UVa 10152
/* coder: ACboy date: 2010-3-6*/#include #include #include #include #include using namespace std;struct cmp{ bool operator () (const string a, const string b) { retu
2010-03-06 23:16:00 887
原创 UVa 133 The Dole Queue
/* coder:ACboy date:2010-3-6 result: AC description: UVa 133 The Dole Queue*/#include using namespace std;// data1个data2两个数组分别用来存储顺时针和逆时针// 查找时要遍历的数据。例如:data1[] = {1, 2, ... , n}
2010-03-06 19:58:00 1176
原创 UVa 127 "Accordian" Patience
/* coder:ACboy date:2010-3-5 result: AC description: UVa 127 "Accordian" Patience*/#include #include using namespace std;// 每张牌的表示struct node { char rank; char suit;};
2010-03-06 15:22:00 1188
原创 UVa 409 Excuses, Excuses!
/* coder: ACboy date: 2010-3-6 result: AC description: UVa 409 Excuses, Excuses!*/#include #include #include #include #include using namespace std;struct node { string str;
2010-03-06 09:29:00 1352
原创 UVa 10112 Myacm Triangles
/* coder:ACboy date: 2010-3-5 result: AC description: UVa 10112 Myacm Triangles*/#include #include using namespace std;#define EP 1e-6struct point{ char label; int x; i
2010-03-05 23:13:00 1019
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人