diff --git a/2862_cow/Readme.md b/2862_cow/Readme.md new file mode 100644 index 0000000..b4f8d75 --- /dev/null +++ b/2862_cow/Readme.md @@ -0,0 +1,3 @@ +# + +* \ No newline at end of file diff --git a/2862_cow/doc/Readme.md b/2862_cow/doc/Readme.md new file mode 100644 index 0000000..4e768b5 --- /dev/null +++ b/2862_cow/doc/Readme.md @@ -0,0 +1 @@ +# \ No newline at end of file diff --git a/2862_cow/doc/麻烦的聚餐.pdf b/2862_cow/doc/麻烦的聚餐.pdf new file mode 100644 index 0000000..6485af1 Binary files /dev/null and b/2862_cow/doc/麻烦的聚餐.pdf differ diff --git a/2862_cow/main.cpp b/2862_cow/main.cpp new file mode 100644 index 0000000..08219e0 --- /dev/null +++ b/2862_cow/main.cpp @@ -0,0 +1,61 @@ +#include +using namespace std; +int mins(int yi,int er){ + return yi>n; + for(int i=1;i<=n;i++){ + cin>>a[i]; + } + int f[30001][4]={0}; + for(int i=1;i<=n;i++){ + for(int j=1;j<=3;j++){ + if(j>i){ + for(int k=j;k<=3;k++){ + f[i][k]=f[i][j-1]; + } + break; + } + bool bian=0; + if(a[i]!=j){ + bian=1; + } + int last=j-1; + if(j-1<1) last=j; + int last2=j-2; + if(j-2<1) last2=j; + f[i][j]=mins(f[i-1][last]+bian,f[i-1][j]+bian); + f[i][j]=mins(f[i-1][last2]+bian,f[i][j]); + // cout<=1;j--){ + if(3-j+1>i){ + for(int k=j;k>=1;k--){ + h[i][k]=h[i][j-1]; + } + break; + } + bool bian=0; + if(a[i]!=j){ + bian=1; + } + int last=j+1; + if(j+1>3) last=j; + int last2=j+2; + if(j+2>3) last2=j; + h[i][j]=mins(h[i-1][last]+bian,h[i-1][j]+bian); + h[i][j]=mins(h[i-1][last2]+bian,h[i][j]); + // cout<