![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
USACO
路迪萨玛
不愿做百夫长的程序猿
展开
-
USACO 1.4.6_skidesign
/* ID: cjn77881 LANG: C++ TASK: skidesign */ //O(n+m)级算法 棒棒哒! #include <stdio.h> typedef struct Ski Ski; struct Ski{ int l,r,Sl,Dl,Sr,Dr; }; int N,idx,ans,val[1000]; Ski a[101]; void swap(...原创 2018-11-01 00:09:19 · 96 阅读 · 0 评论 -
USACO 1.4.5_wormhole
/* ID: cjn77881 LANG: C++ TASK: wormhole */ #include <stdio.h> typedef struct WormHole WormHole; struct WormHole{ int x,y,next,pair; bool v; }; int N,js,ans,array[12]; WormHole wormhole[12...原创 2018-10-14 01:45:26 · 120 阅读 · 0 评论 -
USACO 1.4.4_combo
USACO官方给的是暴力搜索,逐个判断的思路,不涉及搜索算法需要的判重。 我这个题解主要是用的深搜思路,用一个vector数组,精确构造满足题意的组合,然后使用一个1,000,000大的visit数组,记录是否访问过,使用空间换取时间。 /* ID: cjn77881 LANG: C++ TASK: combo */ #include <stdio.h> int N,x1,x2,...原创 2018-10-02 21:52:30 · 114 阅读 · 0 评论 -
USACO 1.4.3_crypt1
/* ID: cjn77881 LANG: C++ TASK: crypt1 */ #include <stdio.h> int N,dgt[10],a[5],ans; bool ilegal(int *a){ if (a[0]==0) return true; if (a[3]==0) return true; return false; } int makeNum1(...原创 2018-10-02 17:48:31 · 125 阅读 · 0 评论 -
USACO 1.4.2_barn1
/* ID: cjn77881 LANG: C++ TASK: barn1 */ #include <stdio.h> int cow[200],dis[200],M,S,C; void swap(int &a,int &b){ int c = a; a = b; b = c; return; } void qSort(int *a,int h,int ...原创 2018-10-02 02:23:11 · 86 阅读 · 0 评论 -
USACO 1.4.1_milk
/* ID: cjn77881 LANG: C++ TASK: milk */ #include <stdio.h> typedef struct Rec Rec; struct Rec{ int p,a; }; int sumA,numF,tmp,idx,ans; Rec rec[5000]; void swap(Rec &a,Rec &b){ Rec c...原创 2018-10-01 14:15:59 · 99 阅读 · 0 评论 -
USACO 1.3.5_dualpal
/* ID: cjn77881 LANG: C++ TASK: dualpal */ #include <stdio.h> #include <string.h> typedef struct RubyArray RubyArray; struct RubyArray{ char a[500]; }; RubyArray getNumber(int x,int b)...原创 2018-10-01 14:15:13 · 88 阅读 · 0 评论 -
USACO 1.3.4_palsquare
/* ID: cjn77881 LANG: C++ TASK: palsquare */ #include <stdio.h> #include <string.h> typedef struct RubyArray RubyArray; struct RubyArray{ char a[20]; }; int N; RubyArray s; RubyArray...原创 2018-10-01 14:14:16 · 110 阅读 · 0 评论 -
USACO 1.3.3_namenum
/* ID: cjn77881 LANG: C++ TASK: namenum */ #include <stdio.h> #include <string.h> char map[100],word[20],number[20],*cn,*cw; int numlen,nans; int main(){ FILE *fin = fopen("namenum.in...原创 2018-10-01 14:13:26 · 108 阅读 · 0 评论 -
USACO 1.3.2_transform
/* ID: cjn77881 LANG: C++ TASK: transform */ #include &lt;stdio.h&gt; #include &lt;string.h&gt; typedef struct matrix matrix; //为了使得函数可以返回二维数组,特定义一个结构体 struct matrix{ char ch[10][10]; }; char ch_...原创 2018-10-01 14:12:04 · 132 阅读 · 0 评论 -
USACO 1.3.1_milk2
/* ID: cjn77881 LANG: C++ TASK: milk2 */ #include &lt;stdio.h&gt; typedef struct Barn Barn; struct Barn{ int l,r; bool v; }; int N,ans_nmmax,ans_max,pre,loc; Barn a[5001]; bool in(int x,int y){...原创 2018-10-01 14:11:00 · 88 阅读 · 0 评论 -
USACO 1.2.4_beads
/* ID: cjn77881 LANG: C TASK: beads */ #include <stdio.h> #include <string.h> char s[701],s2[701]; int N,ans,cal,loc; int calculate(int x,int y){ int js = 0; int i,j; i = x; j = y; ...原创 2018-10-01 14:08:33 · 132 阅读 · 0 评论 -
USACO 1.2.3_friday
/* ID: cjn77881 LANG: C TASK: friday */ #include <stdio.h> int N,dow; int dpm[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int js[7]; int isleap(int y){ //判断是否闰年,是返回1,否返回0 return (y%4 == 0) &...原创 2018-10-01 14:07:36 · 120 阅读 · 0 评论 -
USACO 1.2.2_gift1
/* ID: cjn77881 LANG: C TASK: gift1 */ #include <stdio.h> #include <string.h> #include <assert.h> #include <stdlib.h> #define MaxPeople 10 #define NameLen 15 typedef struct P...原创 2018-10-01 14:06:45 · 76 阅读 · 0 评论 -
USACO 1.2.1_ride
/* ID: cjn77881 LANG: C TASK: ride */ #include &amp;lt;stdio.h&amp;gt; #include &amp;lt;stdlib.h&amp;gt; int a[6],b[6],ans_A,ans_B; char c; int main () { FILE *fin = fopen(&quot;ride.in&quo原创 2018-10-01 01:02:07 · 103 阅读 · 0 评论 -
USACO 1.5.1_ariprog
/* ID: cjn77881 LANG: C++ TASK: ariprog */ #include <stdio.h> int N,M,idx,step,start,Nans; int Numset[30000]; bool v[140000]; void qs(int *a,int h,int t){ if (h>=t) return; int i=h,j=t,x...原创 2018-11-01 00:16:14 · 96 阅读 · 0 评论