![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
usaco
Lawrence_Jang
这个作者很懒,什么都没留下…
展开
-
USACO:Humble Numbers
/*ID: Jang LawrencePROG: humbleLANG: C++*/#include#include#include#include#include#include#include#include#include#define X first#define Y second#define sqr(a) ((a)*(a))using namespac原创 2013-04-21 19:40:21 · 987 阅读 · 0 评论 -
USACO: Cow Pedigrees dp
/*ID: Jang LawrencePROG: nocowsLANG: C++*/#include#include#include#include#includeusing namespace std;typedef long long lng;int f(lng x){ return (x%9901+9901)%9901;}int n,k;lng dp原创 2013-03-08 20:03:04 · 757 阅读 · 0 评论 -
USACO:Preface Numbering
/*ID: Jang LawrencePROG: prefaceLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;int n;char s[][10][5]={{"M","MM","MMM"},{"C","CC","CCC","CD","D"原创 2013-03-07 15:41:48 · 703 阅读 · 0 评论 -
USACO:Hamming Codes
/*ID: Jang LawrencePROG: hammingLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;int n,b,d,a[100],ma;int countbit(int x){return x==0?0:1+countbit原创 2013-03-07 11:21:36 · 1036 阅读 · 0 评论 -
USACO:Zero Sum
/*ID: Jang LawrencePROG: zerosumLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;typedef long long lng;char d[]={" +-"};char opt[10];int n;voi原创 2013-03-07 21:49:43 · 944 阅读 · 0 评论 -
USACO:Subset Sums简单dp
/*ID: Jang LawrencePROG: subsetLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;int n;long long dp[800];int main(){ #ifndef DEBUG freopen(原创 2013-03-07 15:56:54 · 631 阅读 · 0 评论 -
USACO:Party Lamps
/*ID: Jang LawrencePROG: lampsLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;typedef long long lng;int n,c,an;vector s0,s1;int turn_id[]={0,1原创 2013-03-07 19:05:18 · 708 阅读 · 0 评论 -
USACO:Runaround Numbers
/*ID: Jang LawrencePROG: runroundLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;typedef long long lng;lng n;int a[9];vector ans;void pushin(原创 2013-03-07 17:05:16 · 676 阅读 · 0 评论 -
USACO:Longest Prefix简单dp
/*ID: Jang LawrencePROG: prefixLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;typedef long long lng;int n;string list[201],s,pre,t;bool dp[22原创 2013-03-07 20:41:46 · 1255 阅读 · 0 评论 -
USACO:Controlling Companies
/*ID: Jang LawrencePROG: concomLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;typedef long long lng;typedef pair pii;int n;bool is[110][110];原创 2013-03-10 16:35:05 · 702 阅读 · 0 评论 -
USACO:Money System
/*ID: Jang LawrencePROG: moneyLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;typedef long long lng;lng dp[26][10001];int n,sum;int a[30];int原创 2013-03-10 16:03:03 · 757 阅读 · 0 评论 -
USACO:Score Inflation
/*ID: Jang LawrencePROG: inflateLANG: C++*/#include#include#include#include#include#include#include#define X first#define Y second#define sqr(a) ((a)*(a))using namespace std;typedef lo原创 2013-04-20 19:17:59 · 888 阅读 · 0 评论 -
USACO:Agri-Net
/*ID: Jang LawrencePROG: agrinetLANG: C++*/#include#include#include#include#include#include#include#define X first#define Y second#define sqr(a) ((a)*(a))using namespace std;typedef lo原创 2013-04-20 19:09:39 · 895 阅读 · 0 评论 -
USACO:Fractions to Decimals
/*ID: Jang LawrencePROG: fracdecLANG: C++*/#include#include#include#include#include#include#include#define X first#define Y second#define sqr(a) ((a)*(a))using namespace std;typedef lo原创 2013-04-19 21:24:04 · 730 阅读 · 0 评论 -
USACO:Bessie Come Home
/*ID: Jang LawrencePROG: comehomeLANG: C++*/#include#include#include#include#include#include#define X first#define Y second#define sqr(a) ((a)*(a))using namespace std;typedef long long原创 2013-04-19 20:25:22 · 772 阅读 · 0 评论 -
USACO:PROB Cow Tours
/*ID: Jang LawrencePROG: cowtourLANG: C++*/#include#include#include#include#include#include#define X first#define Y second#define sqr(a) ((a)*(a))using namespace std;typedef long long l原创 2013-04-19 19:22:34 · 736 阅读 · 0 评论 -
USACO:Shaping Regions
#include#include#include#include#include#define mp make_pairusing namespace std;typedef long long lng;typedef pair pii;struct seg{ int l,r; seg(){} seg(int x,int y){l=x,r=y;}};int Mi原创 2013-04-23 20:14:06 · 748 阅读 · 0 评论 -
USACO:Overfencing
/*ID: Jang LawrencePROG: maze1LANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;typedef long long lng;typedef pair pii;int m,n;int a[301][301];原创 2013-04-13 15:58:49 · 776 阅读 · 0 评论 -
usaco:The Tamworth Two
/*ID: Jang LawrencePROG: ttwoLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;typedef long long lng;typedef pair pii;char m[11][11];bool is[11]原创 2013-04-05 20:31:37 · 669 阅读 · 0 评论 -
USACO: PROB The Castle
/*ID: Jang LawrencePROG: castleLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;typedef pair pii;int m,n;bool is[55][55][4];int num[3333],id[5原创 2013-03-06 11:22:55 · 637 阅读 · 0 评论 -
USCAO:Ordered Fractions
/*ID: Jang LawrencePROG: frac1LANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;struct p{ int a,v; p(){} p(int x,int y){a=x,v=y;}原创 2013-03-06 13:43:57 · 692 阅读 · 0 评论 -
USACO:Healthy Holsteins
/*ID: Jang LawrencePROG: holsteinLANG: C++*/#include#include#include#include#include#define mp make_pairusing namespace std;int need[30];int n,g,val[16][30],ans,ansx;int countbit(int x){原创 2013-03-06 16:40:21 · 917 阅读 · 0 评论 -
usaco:Milking Cows
额 要细心/*ID: Jang LawrencePROG: milk2LANG: C++*/#include#include#include#includeusing namespace std;int Max(int x,int y){if(x>y) return x; return y;}int n;struct ps{ int l,r;}a[5555]原创 2013-01-17 18:30:40 · 565 阅读 · 0 评论 -
usaco:Transformations
小模拟 没什么好说的/*ID: Jang LawrencePROG: transformLANG: C++*/#include#include#include#includeusing namespace std;int n;bool is(char x[11][11],char y[11][11]){ for(int i=0;i<n;++i) for(原创 2013-01-17 19:35:30 · 466 阅读 · 0 评论 -
usaco:Broken Necklace
没什么好说/*ID: Jang LawrencePROG: beadsLANG: C++*/#include#include#includeusing namespace std;int Max(int x,int y){if(x<y) return y;return x;}int n;char a[1111];int ans;int f(char x,int id原创 2013-01-17 16:55:17 · 440 阅读 · 0 评论 -
USACO:Checker Challenge
深搜一下 稍微优化一下就ok/*ID: Jang LawrencePROG: checkerLANG: C++*/#include#include#include#include#includeusing namespace std;bool is[14];bool is2[30],is3[30];int n,ans;int c[14];bool f(int &x原创 2013-01-26 16:57:44 · 685 阅读 · 0 评论 -
USACO:Superprime Rib
枚举/*ID: Jang LawrencePROG: sprimeLANG: C++*/#include#include#include#include#includeusing namespace std;vector ans[9]; int k=0;bool is[10001];int p[10001];bool g(int x){ if(x==1原创 2013-01-26 15:29:23 · 579 阅读 · 0 评论 -
USACO:Prime Palindromes
枚举枚举枚举/*ID: Jang LawrencePROG: pprimeLANG: C++*/#include#include#include#include#includeusing namespace std;int l,r;int p[10001];bool is[10001];vector ans;char a[11];int n;int turn原创 2013-01-26 14:59:04 · 842 阅读 · 0 评论 -
USACO: PROB Packing Rectangles
超级蛋疼的题 看到第一遍就不想做 拖啊拖 /*ID: Jang LawrencePROG: packrecLANG: C++*/#include#include#include#include#includeusing namespace std;int Max(int x,int y){if(x<y) return y;return x;}struct ps{原创 2013-01-24 14:08:02 · 456 阅读 · 0 评论 -
USACO:Number Triangles
最简单的dp/*ID: Jang LawrencePROG: numtriLANG: C++*/#include#include#include#include#includeusing namespace std;int Max(int x,int y){if(x<y) return y;return x;}int n;int a[1001][1001],dp[10原创 2013-01-24 19:05:03 · 725 阅读 · 0 评论 -
USACO:Dual Palindromes
大水题 /*ID: Jang LawrencePROG: dualpalLANG: C++*/#include#include#include#includeusing namespace std;char a[]={"0123456789ABCDEFGHIJKLMN"};void dfs(int x,int n){ if(x>=n) dfs(x/n,n);原创 2013-01-18 13:54:41 · 400 阅读 · 0 评论 -
USACO:Mixing Milk
简单贪心 没什么好说的/*ID: Jang LawrencePROG: milkLANG: C++*/#include#include#include#includeusing namespace std;int n,m;structps{ int p,num;}a[5010];bool cmp(ps p,ps q){ return p.p<q.p;原创 2013-01-18 22:28:12 · 465 阅读 · 0 评论 -
USACO:The Clocks
/*ID: Jang LawrencePROG: clocksLANG: C++*/#include#include#include#includeusing namespace std;int as[][6]={{1,2,4,5},{1,2,3},{2,3,5,6},{1,4,7},{2,4,5,6,8},{3,6,9},{4,5,7,8},{7,8,9},{5,6,8,9}原创 2013-01-21 20:11:56 · 489 阅读 · 0 评论 -
USACO:Mother's Milk
广搜即可/*ID: Jang LawrencePROG: milk3LANG: C++*/#include#include#include#include#includeusing namespace std;bool is[21][21][21];bool in[21];struct ps{ int a[3]; void f(){is[a[0]][原创 2013-01-22 16:29:56 · 538 阅读 · 0 评论 -
USACO:Arithmetic Progressions
直接枚举/*ID: Jang LawrencePROG: ariprogLANG: C++*/#include#include#include#includeusing namespace std;bool is[125001];int a[125001];int main(){ #ifndef DEBUG freopen("ariprog.in","原创 2013-01-22 15:54:31 · 894 阅读 · 0 评论 -
USACO:Prime Cryptarithm
枚举没什么好说的/*ID: Jang LawrencePROG: crypt1LANG: C++*/#include#include#include#includeusing namespace std;int p[5];int b,c,d,e,f;int ans=0;bool in[10];bool is(){ int x=b*100+c*10+d,y原创 2013-01-19 23:44:44 · 972 阅读 · 2 评论 -
USACO:Calf Flac
玩了一天 晚上才做题/*ID: Jang LawrencePROG: calfflacLANG: C++*/#include#include#include#includeusing namespace std;char a[60100],b[25555];int pos[26555];bool is(char c){ return (c>='A'&&c='原创 2013-01-19 22:17:23 · 844 阅读 · 0 评论 -
Usaco:Palindromic Squares
简单的进制转换/*ID: Jang LawrencePROG: palsquareLANG: C++*/#include#include#include#includeusing namespace std;int n;char a[]={"0123456789ABCDEFGHIJKLMN"};void dfs(int x){ if(x>=n) dfs(x/n原创 2013-01-18 13:45:11 · 478 阅读 · 0 评论 -
USACO:Name That Number
总感觉写的很挫/*ID: Jang LawrencePROG: namenumLANG: C++*/#include#include#include#include#include#includeusing namespace std;char n[13];char temp[13];int num; set Map;char dir[][4]={"ABC"原创 2013-01-18 13:26:26 · 438 阅读 · 0 评论 -
USACO:Barn Repair
简单贪心 细节注意点即可/*ID: Jang LawrencePROG: barn1LANG: C++*/#include#include#include#includeusing namespace std;int m,s,c;int a[1111];int main(){ #ifndef DEBUGfreopen("barn1.in","r",stdi原创 2013-01-18 22:57:07 · 567 阅读 · 0 评论