- 博客(16)
- 收藏
- 关注
原创 USACO 1.5.1_ariprog
/*ID: cjn77881LANG: 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
97
原创 USACO 1.4.6_skidesign
/*ID: cjn77881LANG: C++TASK: skidesign*///O(n+m)级算法 棒棒哒! #include &lt;stdio.h&gt;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
98
原创 USACO 1.4.5_wormhole
/*ID: cjn77881LANG: C++TASK: wormhole*/ #include &amp;amp;lt;stdio.h&amp;amp;gt;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
122
原创 USACO 1.4.4_combo
USACO官方给的是暴力搜索,逐个判断的思路,不涉及搜索算法需要的判重。我这个题解主要是用的深搜思路,用一个vector数组,精确构造满足题意的组合,然后使用一个1,000,000大的visit数组,记录是否访问过,使用空间换取时间。/*ID: cjn77881LANG: C++TASK: combo*/ #include <stdio.h>int N,x1,x2,...
2018-10-02 21:52:30
115
原创 USACO 1.4.3_crypt1
/*ID: cjn77881LANG: 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
127
原创 USACO 1.4.2_barn1
/*ID: cjn77881LANG: 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
93
原创 USACO 1.4.1_milk
/*ID: cjn77881LANG: 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
101
原创 USACO 1.3.5_dualpal
/*ID: cjn77881LANG: 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
89
原创 USACO 1.3.4_palsquare
/*ID: cjn77881LANG: 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
113
原创 USACO 1.3.3_namenum
/*ID: cjn77881LANG: 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
110
原创 USACO 1.3.2_transform
/*ID: cjn77881LANG: 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
135
原创 USACO 1.3.1_milk2
/*ID: cjn77881LANG: 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
90
原创 USACO 1.2.4_beads
/*ID: cjn77881LANG: CTASK: 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
134
原创 USACO 1.2.3_friday
/*ID: cjn77881LANG: CTASK: 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
123
原创 USACO 1.2.2_gift1
/*ID: cjn77881LANG: CTASK: gift1*/#include <stdio.h>#include <string.h>#include <assert.h>#include <stdlib.h>#define MaxPeople 10#define NameLen 15typedef struct P...
2018-10-01 14:06:45
79
原创 USACO 1.2.1_ride
/*ID: cjn77881LANG: CTASK: 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
105
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人