After starting, solve 250 score problem。When I submit, I use about 30 minutes. Score=155.83.
I solve 500 score problem. However, I use about 30 minutes to solve it.Score=281.23.
Challenge Phase, I can't challenge any source. Badly, I'm challenged (TT).
Result:Place=741,Score=155.83.
public class GameOfLifeDivTwo{
public static String theSimulation(String init, int T){
char[] tmpstr=new char[init.length()];
char[] strings=new char[init.length()];
strings=init.toCharArray();
for(int time=0;time<T;time++){
for(int i=0;i<init.length();i++){
int tmp=0;
tmp=strings[i]=='1'?1:0;
tmp+=strings[i==init.length()-1?0:i+1]=='1'?1:0;
tmp+=strings[i==0?init.length()-1:i-1]=='1'?1:0;
if(tmp>=2) tmpstr[i]='1';
else tmpstr[i]='0';
}
for(int i=0;i<init.length();i++) strings[i]=tmpstr[i];
}
String ret=new String(strings);
return ret;
}
}
[500-points](Challenged)
public class Zoo{
public static long theCount(int[] answers){
java.util.Arrays.sort(answers);
int ma,mb=0;
ma=answers[answers.length-1];
if(ma>=answers.length) return 0;
int[] check=new int[ma+1];
for(int i=0;i<ma+1;i++) check[i]=0;
for(int i=0;i<answers.length;i++) check[answers[i]]++;
int flg=0;
for(int i=0;i<ma+1;i++){
if(check[i]!=2 && check[i]!=1 || (flg==1 && check[i]==2)) return 0;
if(check[i]==2) mb++;
else if(check[i]==1 && flg==0) flg=1;
}
long ret=1;
for(int i=0;i<mb;i++) ret*=2;
ret*=2;
return ret;
}
}
0 件のコメント:
コメントを投稿