アットウィキロゴ

ぎs

package neko;
 
 
public class pro {
 
    int number;
    int[] dx=new int[101];
    int[] dy=new int[101];
    int[] pop=new int[101];
    int s,sx,tx;
    int met_area,met_pop;
    int[] group=new int[101];
 
 
    public static void main(String[] args) {
        pro test=new pro();
    }
 
  pro(){  
 
 
 
      tx=0;
      for(s=1;s<11;s++){
      for(sx=1;sx<11;sx++){
      tx=tx+1;
      dy[tx]=s;
      dx[tx]=sx;
      }
      }
 
      for(s=1;s<101;s++){
      pop[s]=(int)(100*Math.random())+1;
      group[s]=s;
      }
 
      int min_pop,min_area;
      int h;
      int op1,op2,g1,g2;
 
      int tr;
 
      for(tr=1;tr<80;tr++){
 
      min_pop=9999;
      min_area=9999;
      op1=0;
      op2=0;
      for(s=1;s<101;s++){
      for(sx=1;sx<101;sx++){
      met(s,sx);    
      if(s==sx)met_area=10000;
      if(s==sx)met_pop=10000;
      g1=group[s];
      g2=group[sx];
      if(g1==g2)met_area=10000;
      if(g1==g2)met_pop=10000;
      if(met_area<min_area)min_pop=met_pop;
      if(met_area<min_area)min_area=met_area;
      h=0;
  if(met_area==min_area)h=h+1;
  if(met_pop<min_pop)h=h+1;
  if(h==2)min_pop=met_pop;    
  if(h==2)min_area=met_area;  
  if(h==2)op1=group[s];
  if(h==2)op2=group[sx];
      }
      }
 
 
 
      for(s=1;s<101;s++){
      if(group[s]==op2)group[s]=op1;
      }
 
   }
 
 
 
 
 
 
 
 
 
 
  }
 
 
void met(int s1,int s2){
 
    double m1,m2;
 
m1=(dx[s1]-dx[s2])*(dx[s1]-dx[s2])+(dy[s1]-dy[s2])*(dy[s1]-dy[s2]);
met_area=(int)Math.sqrt(m1);
m2=(pop[s1]-pop[s2])*(pop[s1]-pop[s2]);    
met_pop=(int)Math.sqrt(m2);
 
}
 
}
最終更新:2014年04月11日 04:19