package delta;
public class pro {
int[][] delta=new int[5000][21];
int[][] alpha=new int[5000][21];
int number_delta,number_alpha;
int k,k2;
int[][] a=new int[100][100];
int number;
int[] de=new int[21];
public static void main(String[] args) {
pro te=new pro();
}
pro(){
int s,sx;
k=60;
k2=2;
sx=0;
for(s=2;s<61;s++){
k=120/s;
if(s*k==120)sx=sx+1;
if(s*k==120)de[sx]=s;
}
number=sx;
System.out.println(number);
int trs;
int count=0;
for(trs=1;trs<8;trs++){
k=de[trs];
k2=120/k;
number_delta=2;
delta[1][1]=1;
delta[2][1]=2;
int r;
for(r=2;r<21;r++){
f(r);
number_delta=0;
for(s=1;s<number_alpha+1;s++){
box sub=new box();
sub.alpha=alpha;
sub.k=k;
sub.makedata(r,s);
a=sub.a;
int ch=check(r);
if(ch>0){
number_delta=number_delta+1;
for(sx=1;sx<r+1;sx++){
delta[number_delta][sx]=alpha[s][sx];
}
}
}
}
count=count+number_delta;
System.out.println(k+","+number_delta);
}
count=2*count;
System.out.println(count);
}
void f(int c){
int s,sx,tx;
tx=0;
for(s=1;s<number_delta+1;s++){
tx=tx+1;
for(sx=1;sx<c;sx++){
alpha[tx][sx]=delta[s][sx];
}
alpha[tx][c]=1;
}
for(s=1;s<number_delta+1;s++){
tx=tx+1;
for(sx=1;sx<c;sx++){
alpha[tx][sx]=delta[s][sx];
}
alpha[tx][c]=2;
}
number_alpha=tx;
}
int check(int r){
int s,sx,n;
n=0;
for(s=1;s<k2+1;s++){
for(sx=1;sx<k+1;sx++){
if(a[s][sx]>60)n=n+1;
}}
int ch=0;
if(n==r*6)ch=100;
return ch;
}
}
package p3;
public class box {
int cx,cy;
int[][] alpha=new int[500000][6];
int[][] a=new int[100][100];
int k;
void makedata(int p,int nx){
int s;
int sx;
for(s=1;s<90;s++){
for(sx=1;sx<90;sx++){
a[s][sx]=0;
}
}
int tr;
for(tr=1;tr<p+1;tr++){
search();
if(alpha[nx][tr]==1)stepx();
if(alpha[nx][tr]==2)stepy();
}
}
void search(){
int s,sx,h;
int miny=999;
for(s=1;s<90;s++){
for(sx=1;sx<90;sx++){
h=0;
if(a[s][sx]<50)h=h+1;
if(s<miny)h=h+1;
if(sx>k)h=0;
if(h==2)miny=s;
}
}
int minx=9999;
for(sx=1;sx<90;sx++){
h=0;
if(a[miny][sx]<50)h=h+1;
if(sx<minx)h=h+1;
if(sx>k)h=0;
if(h==2)minx=sx;
}
cx=minx;
cy=miny;
}
void stepx(){
a[cy][cx]=100;
a[cy][cx+1]=100;
a[cy][cx+2]=100;
a[cy+1][cx]=100;
a[cy+1][cx+1]=100;
a[cy+1][cx+2]=100;
}
void stepy(){
a[cy][cx]=100;
a[cy+1][cx]=100;
a[cy+2][cx]=100;
a[cy][cx+1]=100;
a[cy+1][cx+1]=100;
a[cy+2][cx+1]=100;
}
}
最終更新:2015年10月24日 11:59