USACO
文章平均质量分 63
LucienDuan
这个作者很懒,什么都没留下…
展开
-
USACO Section 1.1 Friday the Thirteenth
/*ID: lucien23PROG: fridayLANG: C++*/#include#include#include#includeusing namespace std;int main(){ ifstream infile("friday.in"); ofstream outfile("friday.out"); if(!infile || !outfil原创 2013-11-22 21:09:17 · 929 阅读 · 0 评论 -
USACO Section 1.4 Mother's Milk
/*ID: lucien23PROG: milk3LANG: C++*/#include#include#include#includeusing namespace std;typedef struct{ int a; int b; int c;}BucketVals;struct comp{ bool operator()(const BucketVa原创 2014-02-19 21:39:28 · 1007 阅读 · 0 评论 -
USACO Section 1.5 Checker Challenge
/*ID: lucien23PROG: checkerLANG: C++*/#include#include#includeint N;int symPos;int sum=0;int count=0;bool isCountComplete=false;bool isPrintComplete=false;int *position;void generate(原创 2014-03-18 21:57:30 · 1107 阅读 · 0 评论 -
USACO Section 1.5 Superprime Rib
/*ID: lucien23PROG: sprimeLANG: C++*/#include#include#include#includeusing namespace std;set primes;//10000以内的素数bool isPrime(int num);int main(){ ifstream infile("sprime.in"); ofstream原创 2014-03-18 21:55:38 · 1063 阅读 · 0 评论 -
USACO Section 1.5 Number Triangles
/*ID: lucien23PROG: numtriLANG: C++*/#include#include#include#includeusing namespace std;int main(){ ifstream infile("numtri.in"); ofstream outfile("numtri.out"); if(!infile || !outfil原创 2014-03-18 21:52:07 · 1138 阅读 · 0 评论 -
USACO Section 1.5 Prime Palindromes
/*ID: lucien23PROG: pprimeLANG: C++*/#include#include#include#include#include#include#includeusing namespace std;set primes;//10000以内的素数bool isPalindrome(int num);bool isPrime(int num原创 2014-03-18 21:54:17 · 1179 阅读 · 0 评论 -
USACO Section 2.1 The Castle
/*ID: lucien23PROG: castleLANG: C++*//************************************************************************//* 求图的连通域问题,利用广度扫描 *//******原创 2014-07-18 21:36:12 · 1111 阅读 · 0 评论 -
USACO Section 2.1 Sorting a Three-Valued Sequence
/*ID: lucien23PROG: sort3LANG: C++*/#include #include #include #include using namespace std;void exchange(int nums[], int begin, int end, int N, int x);int sum = 0;int main(){ ifstream原创 2014-07-18 21:39:54 · 1007 阅读 · 0 评论 -
USACO Section 2.1 Ordered Fractions
/*ID: lucien23PROG: frac1LANG: C++*/#include #include #include #include using namespace std;typedef struct Fraction{ int numerator; int denominator; Fraction(){} Fraction(int x, int y原创 2014-07-18 21:38:30 · 1013 阅读 · 0 评论 -
USACO Section 2.1 Healthy Holsteins
/*ID: lucien23PROG: holsteinLANG: C++*/#include #include #include using namespace std;bool compFun(int x, int y){ int temp, i = 0; while (true) { temp = 1 << i; if (temp&x > temp&y原创 2014-07-24 20:41:52 · 1202 阅读 · 0 评论 -
USACO Section 2.2 Subset Sums
/*ID: lucien23PROG: subsetLANG: C++*/#include #include using namespace std;int main(){ ifstream infile("subset.in"); ofstream outfile("subset.out"); if(!infile || !outfile) { cout <<原创 2014-08-04 11:00:15 · 1278 阅读 · 0 评论 -
USACO Section 2.1 Hamming Codes
/*ID: lucien23PROG: hammingLANG: C++*/#include #include #include using namespace std;int main(){ ifstream infile("hamming.in"); ofstream outfile("hamming.out"); if(!infile || !outfile)原创 2014-07-28 17:15:45 · 959 阅读 · 0 评论 -
USACO Section 2.2 Preface Numbering
/*ID: lucien23PROG: prefaceLANG: C++*/#include #include #include #include using namespace std;int main(){ ifstream infile("preface.in"); ofstream outfile("preface.out"); if(!infile ||原创 2014-07-28 17:17:44 · 939 阅读 · 0 评论 -
USACO Section 2.2 Runaround Numbers
/*ID: lucien23PROG: runroundLANG: C++*/#include #include #include using namespace std;int main(){ ifstream infile("runround.in"); ofstream outfile("runround.out"); if(!infile || !outfil原创 2014-08-04 13:32:08 · 1074 阅读 · 0 评论 -
USACO Section 1.4 Arithmetic Progressions
/*ID: lucien23PROG: ariprogLANG: C++*/#include#include#include#include#includeusing namespace std;typedef struct{ int first; int different;}ArithProgressions;bool compProgressions(Ari原创 2014-02-19 21:38:01 · 1078 阅读 · 0 评论 -
USACO Section 1.4 The Clocks
/*ID: lucien23PROG: clocksLANG: C++*//* *广度优先遍历搜索 *需要适当剪枝 *结果存在内存分配问题 *最后采用枚举法通过测试 **/#include#include#include#includeusing namespace std;typedef struct Solution{ string strNums;原创 2013-12-01 17:36:47 · 811 阅读 · 0 评论 -
USACO Section 1.1 Greedy Gift Givers
/*ID: lucien23PROG: gift1LANG: C++*/#include#include#include#includeusing namespace std;int main(){ ifstream infile("gift1.in"); ofstream outfile("gift1.out"); if(!infile || !outfile)原创 2013-11-22 21:06:51 · 858 阅读 · 0 评论 -
USACO Section 1.1 Broken Necklace
/*ID: lucien23PROG: beadsLANG: C++*/#include#include#include#includeusing namespace std;int main(){ ifstream infile("beads.in"); ofstream outfile("beads.out"); if(!infile || !outfile)原创 2013-11-22 21:10:45 · 964 阅读 · 0 评论 -
USACO Section 1.2 Palindromic Squares
/*ID: lucien23PROG: palsquareLANG: C++*/#include#include#include#include#include#includeusing namespace std;string num2string(int num,int baseNum);int main(){ ifstream infile("palsquar原创 2013-11-25 21:43:30 · 888 阅读 · 0 评论 -
USACO Section 1.3 Mixing Milk
/*ID: lucien23PROG: milkLANG: C++*/#include#include#includeusing namespace std;typedef struct Farmer{ int price; int amount; Farmer(){} Farmer(int p,int a) { price=p; amount=a;原创 2013-11-25 21:46:08 · 723 阅读 · 0 评论 -
USACO Section 1.3 Calf Flac
/*ID: lucien23PROG: calfflacLANG: C++*/#include#include#include#includeusing namespace std;int main(){ ifstream infile("calfflac.in"); ofstream outfile("calfflac.out"); if(!infile || !原创 2013-11-26 22:46:34 · 889 阅读 · 0 评论 -
USACO Section 1.3 Prime Cryptarithm
/*ID: lucien23PROG: crypt1LANG: C++*/#include#include#includeusing namespace std;int main(){ ifstream infile("crypt1.in"); ofstream outfile("crypt1.out"); if(!infile || !outfile) { c原创 2013-11-27 12:02:44 · 857 阅读 · 0 评论 -
USACO Section 1.4 Packing Rectangles
/*ID: lucien23PROG: packrecLANG: C++*//* *深度优先遍历,找出最优解 *此题是我做USACO到目前为止花时间最多的 *很郁闷 **/#include#include#include#includeusing namespace std;typedef struct Rectangle{ int width; int原创 2013-11-29 11:42:21 · 1120 阅读 · 0 评论 -
USACO Section 1.1 Your Ride Is Here
/*ID: lucien23PROG: rideLANG: C++*/#include#include#includeusing namespace std;int main(){ifstream infile("ride.in");ofstream outfile("ride.out");string strComet,strG原创 2013-11-22 21:03:44 · 873 阅读 · 0 评论 -
USACO Section 1.2 Milking Cows
/*ID: lucien23PROG: milk2LANG: C++*/#include#include#includeusing namespace std;typedef struct Milking{ int start; int end; Milking(){} Milking(int startTime,int endTime) { start=原创 2013-11-23 15:30:43 · 938 阅读 · 0 评论 -
USACO Section 1.2 Transformations
/*ID: lucien23PROG: transformLANG: C++*/#include#include#include#includeusing namespace std;int main(){ ifstream infile("transform.in"); ofstream outfile("transform.out"); if(!infile |原创 2013-11-23 17:30:24 · 1025 阅读 · 0 评论 -
USACO Section 1.2 Name That Number
/*ID: lucien23PROG: namenumLANG: C++*/#include#include#include#include#includeusing namespace std;int main(){ ifstream infile("namenum.in"); ifstream inDict("dict.txt"); ofstream outf原创 2013-11-23 23:40:17 · 875 阅读 · 0 评论 -
USACO Section 1.2 Dual Palindromes
/*ID: lucien23PROG: dualpalLANG: C++*/#include#include#include#includeusing namespace std;string num2string(int num,int baseNum);int main(){ ifstream infile("dualpal.in"); ofstream outf原创 2013-11-25 21:44:45 · 876 阅读 · 0 评论 -
USACO Section 1.3 Barn Repair
/*ID: lucien23PROG: barn1LANG: C++*/#include#include#include#includeusing namespace std;int main(){ ifstream infile("barn1.in"); ofstream outfile("barn1.out"); if(!infile || !outfile)原创 2013-11-25 21:47:27 · 704 阅读 · 0 评论 -
USACO Section 2.2 Party Lamps
/*ID: lucien23PROG: lampsLANG: C++*//* * 此题的技巧之处就是需要注意到任何button只要按下2的倍数次就相当于没有按 * 所以其实只需要考虑4个按钮,每个按钮是否被有效按下过一次就好 * 直接使用枚举法,一共只有2^4=16种情况 * 对于每种情况需要知道被按下的有效次数(也就是被按下过的按钮数),必须满足 * (C-有效次数)%2=0原创 2014-08-04 15:13:27 · 1136 阅读 · 0 评论