DevQuiz 惨敗でしたorz

DevQuiz惨敗でとても凹んでいます。
まず、得点はまさかの70点。 スタートライン(100点)に到達できなかった(ToT)

では私の間違っている回答とかひどいソースを晒します。一人ゲームのやつは答え(最短手数)がマジで知りたいです。
おかしいところはバシバシご指摘頂けると幸いです。

まずはウォーミングアップクイズ。これはヒントとか書いてありましたし、一発で全問正解です。

次ぎにWeb Game。

これは日本語プログラミング言語なでしこを使って解きました。動画をご覧下さい。

なでしこのブラウザ要素クリック命令を使って総当り攻撃してクリアしました。
わかりやすいように1手1手の間にスリープをかましてあります。
実際には一瞬で次の問題へどんどん進む感じです。
ソースは19行です。
[text]
母艦を最大化
Browserとはブラウザ
そのURLは「http://gdd-2011-quiz-japan.appspot.com/webgame/problem」
そのレイアウトは全体
Browserのブラウザ読込待機

BrowserのEmailに「********@gmail.com」をブラウザINPUT値設定
BrowserのPasswdに「********」をブラウザINPUT値設定
BrowserのsignInをブラウザ要素クリック
2秒待つ
Browserのブラウザ読込待機
iを0から1023まで繰り返す
0.000001秒待つ
jを0から1023まで繰り返す
Browserの「card{i}」をブラウザ要素クリック
HTML=Browserの「card{i}」をブラウザHTML取得
HTMLをメモ記入
Browserの「card{j}」をブラウザ要素クリック

「完了」と言う
終了
[/text]

そして時間をアホのように費やしてしまった一人ゲーム。
とても悔しいんだけど、これは一番楽しかった。

何回やっても不正解をくらいました。
これが私の回答です。(間違っています)
[text]
2
5
8
4
1
1
16
1
1
2
4
20
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
11
15
15
15
15
14
15
21
21
12
21
16
21
21
13
14
21
21
21
21
15
8
14
21
8
11
10
21
13
15
21
14
13
16
13
21
8
13
12
1
5
9
11
7
7
1
6
6
17
1
3
3
1
21
21
16
16
16
6
21
21
21
10
9
6
10
21
[/text]

そして稚拙なソースです。

public class OneGame {

	public static void main(String[] args) {
		int[] result1 = new int[100];
		int[] result2 = new int[100];
		int[] result3 = new int[100];
		int[] result4 = new int[100];
		int[] result5 = new int[100];
		int[] result6 = new int[100];

		result1 = Turn1();
		result2 = Turn2();
		result3 = Turn3();
		result4 = Turn4();
		result5 = Turn5();
		result6 = Turn6();

		for(int i=0;i<100;i++){
			if(result1[i]<=result2[i] && result1[i]<=result3[i] && result1[i]<=result4[i] && result1[i]<=result5[i] && result1[i]<=result6[i]){
				//System.out.println((i+1)+"	"+result1[i]+"	1");
				System.out.println(result1[i]);
			}
			else if(result2[i]<=result1[i] && result2[i]<=result3[i] && result2[i]<=result4[i] && result2[i]<=result5[i] && result2[i]<=result6[i]){
				//System.out.println((i+1)+"	"+result2[i]+"	2");
				System.out.println(result2[i]);
			}
			else if(result3[i]<=result1[i] && result3[i]<=result2[i] && result3[i]<=result4[i] && result3[i]<=result5[i] && result3[i]<=result6[i]){
				//System.out.println((i+1)+"	"+result3[i]+"	3");
				System.out.println(result3[i]);
			}
			else if(result4[i]<=result1[i] && result4[i]<=result2[i] && result4[i]<=result3[i] && result4[i]<=result5[i] && result4[i]<=result6[i]){
				//System.out.println((i+1)+"	"+result4[i]+"	4");
				System.out.println(result4[i]);
			}
			else if(result5[i]<=result1[i] && result5[i]<=result2[i] && result5[i]<=result3[i] && result5[i]<=result4[i] && result5[i]<=result6[i]){
				//System.out.println((i+1)+"	"+result5[i]+"	5");
				System.out.println(result5[i]);
			}
			else if(result6[i]<=result1[i] && result6[i]<=result2[i] && result6[i]<=result3[i] && result6[i]<=result4[i] && result6[i]<=result5[i]){
				//System.out.println((i+1)+"	"+result6[i]+"	6");
				System.out.println(result6[i]);
			}
		}
	}

	private static int[] Turn1(){
		int sum =0;
		int Opr =0;
		int[] flag = new int[10];
		int[] turn = new int[100];
		Object[][] testcase = {
				{10,11},
				{0,9,9},
				{81,67,83,86},
				{11,22,30},
				{0},
				{5},
				{999999},
				{1000000},
				{5,10},
				{0,10,11},
				{10,20,21,22,23},
				{422808,211404,761062,845625,491519},
				{13,64,68,17,19},
				{93,31,72,65,75},
				{84,99,41,25,93},
				{2,72,63,58,66},
				{62,79,49,98,67},
				{87,31,37,36,95},
				{65,15,12,43,91},
				{34,71,60,41,95},
				{96,54,69,16,96},
				{73,69,64,92,24},
				{4,69,91,97,20,90,21,62,90,13},
				{75,72,44,100,96,12,99,59,4,97},
				{0,79,30,83,46,56,61,49,60,89},
				{10,72,2,7,75,26,82,30,57,2},
				{73,41,24,43,21,42,76,26,24,9},
				{59,77,32,6,23,87,97,23,43,32},
				{100,20,12,96,63,16,14,21,90,31},
				{6,18,19,51,54,70,10,96,80,62},
				{31,11,54,88,48,22,41,17,23,91},
				{45,59,56,4,13,95,65,81,64,79},
				{990492,953221,920810,925284,861402},
				{899023,958739,958208,836961,925983},
				{911568,986679,994864,913816,813822},
				{956961,827371,995429,889788,892175},
				{839452,878345,954982,995491,834352},
				{802331,957687,915094,875111,832466},
				{882981,867664,896820,809482,923023},
				{829415,814512,940226,978115,831827},
				{806232,837813,961698,844056,983721},
				{923071,972399,982766,907131,850043},
				{822380,818586,871538,983745,960983,888003,964137,810508,899267,973336},
				{900100,982013,808539,976012,951908,845870,821011,870749,835719,886450},
				{838102,882622,987311,850465,853342,924716,844930,821971,847907,921772},
				{960016,863774,990144,845274,819333,989933,990153,959626,915206,820545},
				{804154,989730,955129,987771,980677,943257,812049,869455,911280,997259},
				{914490,957061,893002,957989,900964,988645,967661,956006,920414,862668},
				{861248,833995,928360,905682,825217,819327,966070,921564,807581,962290},
				{957683,939387,929149,876470,949392,911001,816772,936305,874797,818163},
				{806342,944111,889814,947927,923905,816274,952687,933739,866972,851059},
				{927477,808550,854154,941801,808248,837432,905868,994125,928239,895436},
				{988355,859418,943243,85,31,908839,5,967426,81,76},
				{920885,96,93,81,91,910368,815514,859321,10,981845},
				{44,912531,853040,12,960455,34,47,950435,88,863403},
				{73,922852,948456,834894,2,960106,78,65,842099,94},
				{803747,907241,93,48,909454,6,831646,39,51,992766},
				{876093,972202,49,81,880075,870892,80,54,953444,70},
				{98,920283,65,72,926740,84,850577,61,971311,876298},
				{55,951463,27,65,51,931780,802803,822026,858115,2},
				{921210,76,96,56,883540,45,802952,875906,897253,13},
				{959601,94,79,907610,74,930570,925235,100,51,912353},
				{57,990272,83,72,872502,9,93,902753,959862,914956},
				{932080,13,918249,845303,11,952276,18,865247,47,72},
				{861980,903396,83,35,944843,28,20,835860,11,826473},
				{936501,832727,66,8,42,52,55,956372,985537,917775},
				{847993,36,36,69,968095,945997,94,941853,963485,29},
				{823023,909096,962680,41,41,54,883159,848431,94,0},
				{946709,91,23,949782,863270,74,851065,92,39,930297},
				{837100,803780,860731,994749,69,84,9,27,29,988495},
				{29,802154,817777,71,24,53,960860,991250,900741,90},
				{879442,44,71,909470,55,830018,953556,870500,71,48},
				{128045,198660,195045,292430,938475,848800,658025,18395,285990},
				{105845,925965,42160,838685,448125,867103,278575,425151,715515,408045},
				{348100,453269,401085,893840,905165,306894,636900,922294,718150},
				{100630,63625,778340,311801,963520,43070,47584,476250,681507,550577},
				{491085,978917,858207,935090,442655,382695,788275,108640,460810,548910},
				{501580,624375,760010,976280,850614,3461,238315,948471,122520},
				{35065,514755,37685,48695,966305,737615,768375,159990,984840,275120},
				{531255,280470,150040,191880,883375,779620,215615,391315,941299},
				{11965,264895,180705,438700,341955,152125,970615,108987,376215},
				{385589,222710,550825,8590,470980,857260,871945},
				{548095,171865,541530,47860,52915,556140,345710},
				{497425,532135,891590,115850,321655,141230,319363},
				{131145,824840,61682,750820,456200,448650,805700,406905,285575,296420},
				{658160,57975,655620,73875,868865,157425,221280,230000,303105,788835},
				{129505,225175,889478,183482,497060,601970,216510,328200,719735},
				{633558,9235,550805,186875,950260,693970,626480,312052,355210},
				{289493,206540,873310,579285,292110,75415,518399,277095,531205,201726},
				{4600,186240,633895,291565,880145,415980,510677,571620},
				{292940,358186,173775,618978,554415,145015,744130,263230,998825},
				{894815,519560,841626,226210,238400,861200,551280,305785,544815},
				{42173,442414,28217,528438,806372,831256,52691,469314,527242},
				{648135,857252,707497,674046,907447},
				{654777,56384,576619,28417,388568,631976,468675},
				{607408,233855,467335,999846,970166,891046,186959,190439,647967},
				{412288,567395,46370,807131,318180,747962},
				{346635,30738,802843,518662,83440},
				{34164,676647,72118},
				{67490,35919,955396,896463,760949,602740,657628,626224,85892,272851}
		};


		for(int i=0;i<testcase.length;i++){

			//合計フラグの初期化
			sum=0;

			//フラグ配列の初期化
			for(int j=0;j<10;j++){
				flag[j]=0;
			}

			//turnの初期化
			turn[i]=0;

			//全要素の末尾が0もしくは5になるまで各要素単位への処理を繰り返す
			while(sum!=testcase[i].length){

				sum=0;

				//フラグ配列の初期化
				for(int j=0;j<10;j++){
					flag[j]=0;
				}

				//各要素の末尾が0もしくは5であるかの判定処理
				for(int k=0;k<testcase[i].length;k++){
					if(flag[k]==0 && (String.valueOf(testcase[i][k]).endsWith("0")==true || String.valueOf(testcase[i][k]).endsWith("5")==true)){
						flag[k] =1;
					}
					sum += flag[k];
				}

				//全要素の末尾が0もしくは5である場合はturnを+1して削除
				if(sum==testcase[i].length){
					for(int n=0;n<testcase[i].length;n++){
						testcase[i][n]=null;
					}
					turn[i]++;
				}

				//違えば1/2にする。
				else if(sum!=testcase[i].length){
					for(int m=0;m<testcase[i].length;m++){
						Opr=(Integer) testcase[i][m];
						testcase[i][m]=Opr/2;
					}
					turn[i]++;
				}
			}
			//System.out.println(turn[i]);
		}
		return turn;
	}

	private static int[] Turn2(){
		int sumA = 0;
		int sumB = 0;
		int Opr = 0;
		int Opr2 = 0;
		int[] turn = new int[100];
		int[] flag = new int[10];
		int[] next = new int[10];

		Object[][] testcase = {
				{10,11},
				{0,9,9},
				{81,67,83,86},
				{11,22,30},
				{0},
				{5},
				{999999},
				{1000000},
				{5,10},
				{0,10,11},
				{10,20,21,22,23},
				{422808,211404,761062,845625,491519},
				{13,64,68,17,19},
				{93,31,72,65,75},
				{84,99,41,25,93},
				{2,72,63,58,66},
				{62,79,49,98,67},
				{87,31,37,36,95},
				{65,15,12,43,91},
				{34,71,60,41,95},
				{96,54,69,16,96},
				{73,69,64,92,24},
				{4,69,91,97,20,90,21,62,90,13},
				{75,72,44,100,96,12,99,59,4,97},
				{0,79,30,83,46,56,61,49,60,89},
				{10,72,2,7,75,26,82,30,57,2},
				{73,41,24,43,21,42,76,26,24,9},
				{59,77,32,6,23,87,97,23,43,32},
				{100,20,12,96,63,16,14,21,90,31},
				{6,18,19,51,54,70,10,96,80,62},
				{31,11,54,88,48,22,41,17,23,91},
				{45,59,56,4,13,95,65,81,64,79},
				{990492,953221,920810,925284,861402},
				{899023,958739,958208,836961,925983},
				{911568,986679,994864,913816,813822},
				{956961,827371,995429,889788,892175},
				{839452,878345,954982,995491,834352},
				{802331,957687,915094,875111,832466},
				{882981,867664,896820,809482,923023},
				{829415,814512,940226,978115,831827},
				{806232,837813,961698,844056,983721},
				{923071,972399,982766,907131,850043},
				{822380,818586,871538,983745,960983,888003,964137,810508,899267,973336},
				{900100,982013,808539,976012,951908,845870,821011,870749,835719,886450},
				{838102,882622,987311,850465,853342,924716,844930,821971,847907,921772},
				{960016,863774,990144,845274,819333,989933,990153,959626,915206,820545},
				{804154,989730,955129,987771,980677,943257,812049,869455,911280,997259},
				{914490,957061,893002,957989,900964,988645,967661,956006,920414,862668},
				{861248,833995,928360,905682,825217,819327,966070,921564,807581,962290},
				{957683,939387,929149,876470,949392,911001,816772,936305,874797,818163},
				{806342,944111,889814,947927,923905,816274,952687,933739,866972,851059},
				{927477,808550,854154,941801,808248,837432,905868,994125,928239,895436},
				{988355,859418,943243,85,31,908839,5,967426,81,76},
				{920885,96,93,81,91,910368,815514,859321,10,981845},
				{44,912531,853040,12,960455,34,47,950435,88,863403},
				{73,922852,948456,834894,2,960106,78,65,842099,94},
				{803747,907241,93,48,909454,6,831646,39,51,992766},
				{876093,972202,49,81,880075,870892,80,54,953444,70},
				{98,920283,65,72,926740,84,850577,61,971311,876298},
				{55,951463,27,65,51,931780,802803,822026,858115,2},
				{921210,76,96,56,883540,45,802952,875906,897253,13},
				{959601,94,79,907610,74,930570,925235,100,51,912353},
				{57,990272,83,72,872502,9,93,902753,959862,914956},
				{932080,13,918249,845303,11,952276,18,865247,47,72},
				{861980,903396,83,35,944843,28,20,835860,11,826473},
				{936501,832727,66,8,42,52,55,956372,985537,917775},
				{847993,36,36,69,968095,945997,94,941853,963485,29},
				{823023,909096,962680,41,41,54,883159,848431,94,0},
				{946709,91,23,949782,863270,74,851065,92,39,930297},
				{837100,803780,860731,994749,69,84,9,27,29,988495},
				{29,802154,817777,71,24,53,960860,991250,900741,90},
				{879442,44,71,909470,55,830018,953556,870500,71,48},
				{128045,198660,195045,292430,938475,848800,658025,18395,285990},
				{105845,925965,42160,838685,448125,867103,278575,425151,715515,408045},
				{348100,453269,401085,893840,905165,306894,636900,922294,718150},
				{100630,63625,778340,311801,963520,43070,47584,476250,681507,550577},
				{491085,978917,858207,935090,442655,382695,788275,108640,460810,548910},
				{501580,624375,760010,976280,850614,3461,238315,948471,122520},
				{35065,514755,37685,48695,966305,737615,768375,159990,984840,275120},
				{531255,280470,150040,191880,883375,779620,215615,391315,941299},
				{11965,264895,180705,438700,341955,152125,970615,108987,376215},
				{385589,222710,550825,8590,470980,857260,871945},
				{548095,171865,541530,47860,52915,556140,345710},
				{497425,532135,891590,115850,321655,141230,319363},
				{131145,824840,61682,750820,456200,448650,805700,406905,285575,296420},
				{658160,57975,655620,73875,868865,157425,221280,230000,303105,788835},
				{129505,225175,889478,183482,497060,601970,216510,328200,719735},
				{633558,9235,550805,186875,950260,693970,626480,312052,355210},
				{289493,206540,873310,579285,292110,75415,518399,277095,531205,201726},
				{4600,186240,633895,291565,880145,415980,510677,571620},
				{292940,358186,173775,618978,554415,145015,744130,263230,998825},
				{894815,519560,841626,226210,238400,861200,551280,305785,544815},
				{42173,442414,28217,528438,806372,831256,52691,469314,527242},
				{648135,857252,707497,674046,907447},
				{654777,56384,576619,28417,388568,631976,468675},
				{607408,233855,467335,999846,970166,891046,186959,190439,647967},
				{412288,567395,46370,807131,318180,747962},
				{346635,30738,802843,518662,83440},
				{34164,676647,72118},
				{67490,35919,955396,896463,760949,602740,657628,626224,85892,272851}
		};

		for(int i=0;i<testcase.length;i++){

			//合計フラグの初期化
			sumA=0;
			sumB=0;

			//フラグ配列の初期化
			for(int j=0;j<10;j++){
				flag[j]=0;
				next[j]=0;
			}

			//turnの初期化
			turn[i]=0;

			//全要素の末尾が0もしくは5になるまで各要素単位への処理を繰り返す
			while(sumA!=testcase[i].length){

				sumA=0;
				sumB=0;

				//フラグ配列の初期化
				for(int j=0;j<10;j++){
					flag[j]=0;
					next[j]=0;
				}

				//とにかく1/2にする。
				for(int m=0;m<testcase[i].length;m++){
					if(testcase[i][m]==null){
						testcase[i][m]=0;
					}
					Opr = (Integer)testcase[i][m];
					testcase[i][m]=Opr/2;
				}
				turn[i]++;

				//各要素の末尾が0もしくは5であるかの判定処理
				for(int k=0;k<testcase[i].length;k++){
					if(flag[k]==0 && (String.valueOf(testcase[i][k]).endsWith("0")==true || String.valueOf(testcase[i][k]).endsWith("5")==true)){
						flag[k] =1;
					}
					sumA += flag[k];
				}

				//末尾が0もしくは1であるかの判定処理
				for(int k=0;k<testcase[i].length;k++){
					if(next[k]==0 && (String.valueOf(testcase[i][k]).endsWith("0")==true || String.valueOf(testcase[i][k]).endsWith("1")==true)){
						next[k] =1;
					}
					sumB += next[k];
				}

				//1つでも末尾が0もしくは5の要素がある場合削除
				if(sumA>0){
					for(int k=0;k<testcase[i].length;k++){
						if(testcase[i][k]==null){
							testcase[i][k]=0;
						}
						Opr2 = (Integer)testcase[i][k];
						if(flag[k]==1 && sumA>=sumB){
							testcase[i][k]=null;
						}
						else{
							testcase[i][k]=Opr2/2;
						}
					}
					turn[i]++;
				}
			}
			//System.out.println(turn[i]);
		}
		return turn;
	}

	private static int[] Turn3(){
		int sumA = 0;
		int sumB = 0;
		int Opr = 0;
		int Opr2 =0;
		int[] flag = new int[10];
		int[] next = new int[10];
		int[] turn = new int[100];
		Object[][] testcase = {
				{10,11},
				{0,9,9},
				{81,67,83,86},
				{11,22,30},
				{0},
				{5},
				{999999},
				{1000000},
				{5,10},
				{0,10,11},
				{10,20,21,22,23},
				{422808,211404,761062,845625,491519},
				{13,64,68,17,19},
				{93,31,72,65,75},
				{84,99,41,25,93},
				{2,72,63,58,66},
				{62,79,49,98,67},
				{87,31,37,36,95},
				{65,15,12,43,91},
				{34,71,60,41,95},
				{96,54,69,16,96},
				{73,69,64,92,24},
				{4,69,91,97,20,90,21,62,90,13},
				{75,72,44,100,96,12,99,59,4,97},
				{0,79,30,83,46,56,61,49,60,89},
				{10,72,2,7,75,26,82,30,57,2},
				{73,41,24,43,21,42,76,26,24,9},
				{59,77,32,6,23,87,97,23,43,32},
				{100,20,12,96,63,16,14,21,90,31},
				{6,18,19,51,54,70,10,96,80,62},
				{31,11,54,88,48,22,41,17,23,91},
				{45,59,56,4,13,95,65,81,64,79},
				{990492,953221,920810,925284,861402},
				{899023,958739,958208,836961,925983},
				{911568,986679,994864,913816,813822},
				{956961,827371,995429,889788,892175},
				{839452,878345,954982,995491,834352},
				{802331,957687,915094,875111,832466},
				{882981,867664,896820,809482,923023},
				{829415,814512,940226,978115,831827},
				{806232,837813,961698,844056,983721},
				{923071,972399,982766,907131,850043},
				{822380,818586,871538,983745,960983,888003,964137,810508,899267,973336},
				{900100,982013,808539,976012,951908,845870,821011,870749,835719,886450},
				{838102,882622,987311,850465,853342,924716,844930,821971,847907,921772},
				{960016,863774,990144,845274,819333,989933,990153,959626,915206,820545},
				{804154,989730,955129,987771,980677,943257,812049,869455,911280,997259},
				{914490,957061,893002,957989,900964,988645,967661,956006,920414,862668},
				{861248,833995,928360,905682,825217,819327,966070,921564,807581,962290},
				{957683,939387,929149,876470,949392,911001,816772,936305,874797,818163},
				{806342,944111,889814,947927,923905,816274,952687,933739,866972,851059},
				{927477,808550,854154,941801,808248,837432,905868,994125,928239,895436},
				{988355,859418,943243,85,31,908839,5,967426,81,76},
				{920885,96,93,81,91,910368,815514,859321,10,981845},
				{44,912531,853040,12,960455,34,47,950435,88,863403},
				{73,922852,948456,834894,2,960106,78,65,842099,94},
				{803747,907241,93,48,909454,6,831646,39,51,992766},
				{876093,972202,49,81,880075,870892,80,54,953444,70},
				{98,920283,65,72,926740,84,850577,61,971311,876298},
				{55,951463,27,65,51,931780,802803,822026,858115,2},
				{921210,76,96,56,883540,45,802952,875906,897253,13},
				{959601,94,79,907610,74,930570,925235,100,51,912353},
				{57,990272,83,72,872502,9,93,902753,959862,914956},
				{932080,13,918249,845303,11,952276,18,865247,47,72},
				{861980,903396,83,35,944843,28,20,835860,11,826473},
				{936501,832727,66,8,42,52,55,956372,985537,917775},
				{847993,36,36,69,968095,945997,94,941853,963485,29},
				{823023,909096,962680,41,41,54,883159,848431,94,0},
				{946709,91,23,949782,863270,74,851065,92,39,930297},
				{837100,803780,860731,994749,69,84,9,27,29,988495},
				{29,802154,817777,71,24,53,960860,991250,900741,90},
				{879442,44,71,909470,55,830018,953556,870500,71,48},
				{128045,198660,195045,292430,938475,848800,658025,18395,285990},
				{105845,925965,42160,838685,448125,867103,278575,425151,715515,408045},
				{348100,453269,401085,893840,905165,306894,636900,922294,718150},
				{100630,63625,778340,311801,963520,43070,47584,476250,681507,550577},
				{491085,978917,858207,935090,442655,382695,788275,108640,460810,548910},
				{501580,624375,760010,976280,850614,3461,238315,948471,122520},
				{35065,514755,37685,48695,966305,737615,768375,159990,984840,275120},
				{531255,280470,150040,191880,883375,779620,215615,391315,941299},
				{11965,264895,180705,438700,341955,152125,970615,108987,376215},
				{385589,222710,550825,8590,470980,857260,871945},
				{548095,171865,541530,47860,52915,556140,345710},
				{497425,532135,891590,115850,321655,141230,319363},
				{131145,824840,61682,750820,456200,448650,805700,406905,285575,296420},
				{658160,57975,655620,73875,868865,157425,221280,230000,303105,788835},
				{129505,225175,889478,183482,497060,601970,216510,328200,719735},
				{633558,9235,550805,186875,950260,693970,626480,312052,355210},
				{289493,206540,873310,579285,292110,75415,518399,277095,531205,201726},
				{4600,186240,633895,291565,880145,415980,510677,571620},
				{292940,358186,173775,618978,554415,145015,744130,263230,998825},
				{894815,519560,841626,226210,238400,861200,551280,305785,544815},
				{42173,442414,28217,528438,806372,831256,52691,469314,527242},
				{648135,857252,707497,674046,907447},
				{654777,56384,576619,28417,388568,631976,468675},
				{607408,233855,467335,999846,970166,891046,186959,190439,647967},
				{412288,567395,46370,807131,318180,747962},
				{346635,30738,802843,518662,83440},
				{34164,676647,72118},
				{67490,35919,955396,896463,760949,602740,657628,626224,85892,272851}
		};


		for(int i=0;i<testcase.length;i++){

			//合計フラグの初期化
			sumA=0;
			sumB=0;

			//フラグ配列の初期化
			for(int j=0;j<10;j++){
				flag[j]=0;
				next[j]=0;
			}

			//turnの初期化
			turn[i]=0;

			//全要素の末尾が0もしくは5になるまで各要素単位への処理を繰り返す
			while(sumA!=testcase[i].length){

				sumA=0;
				sumB=0;

				//フラグ配列の初期化
				for(int j=0;j<10;j++){
					flag[j]=0;
					next[j]=0;
				}


				//末尾が0もしくは5であるかの判定処理
				for(int k=0;k<testcase[i].length;k++){
					if(flag[k]==0 && (String.valueOf(testcase[i][k]).endsWith("0")==true || String.valueOf(testcase[i][k]).endsWith("5")==true)){
						flag[k] =1;
					}
					sumA += flag[k];
				}

				//末尾が0もしくは1であるかの判定処理
				for(int k=0;k<testcase[i].length;k++){
					if(next[k]==0 && (String.valueOf(testcase[i][k]).endsWith("0")==true || String.valueOf(testcase[i][k]).endsWith("1")==true)){
						next[k] =1;
					}
					sumB += next[k];
				}

				//1つでも末尾が0もしくは5である場合は削除してturnを+1
				if(sumA>0){
					for(int n=0;n<testcase[i].length;n++){
						if(testcase[i][n]==null){
							testcase[i][n]=0;
						}
						Opr2 =(Integer)testcase[i][n];
						if(flag[n]==1 && sumA>=sumB && Opr2>=100 ){
							testcase[i][n]=null;
						}
						else{
							testcase[i][n]=Opr2/2;
						}
					}
					turn[i]++;
				}
				//違えば1/2にする。
				else{
					for(int m=0;m<testcase[i].length;m++){
						if(testcase[i][m]==null){
							testcase[i][m]=0;
						}
						Opr=(Integer) testcase[i][m];
						testcase[i][m]=Opr/2;
					}
					turn[i]++;
				}
			}
			//System.out.println(turn[i]);
		}
		return turn;
	}

	private static int[] Turn4(){
		int sum = 0;
		int Opr = 0;
		int[] turn = new int[100];
		int[] flag = new int[10];
		Object[][] testcase = {
				{10,11},
				{0,9,9},
				{81,67,83,86},
				{11,22,30},
				{0},
				{5},
				{999999},
				{1000000},
				{5,10},
				{0,10,11},
				{10,20,21,22,23},
				{422808,211404,761062,845625,491519},
				{13,64,68,17,19},
				{93,31,72,65,75},
				{84,99,41,25,93},
				{2,72,63,58,66},
				{62,79,49,98,67},
				{87,31,37,36,95},
				{65,15,12,43,91},
				{34,71,60,41,95},
				{96,54,69,16,96},
				{73,69,64,92,24},
				{4,69,91,97,20,90,21,62,90,13},
				{75,72,44,100,96,12,99,59,4,97},
				{0,79,30,83,46,56,61,49,60,89},
				{10,72,2,7,75,26,82,30,57,2},
				{73,41,24,43,21,42,76,26,24,9},
				{59,77,32,6,23,87,97,23,43,32},
				{100,20,12,96,63,16,14,21,90,31},
				{6,18,19,51,54,70,10,96,80,62},
				{31,11,54,88,48,22,41,17,23,91},
				{45,59,56,4,13,95,65,81,64,79},
				{990492,953221,920810,925284,861402},
				{899023,958739,958208,836961,925983},
				{911568,986679,994864,913816,813822},
				{956961,827371,995429,889788,892175},
				{839452,878345,954982,995491,834352},
				{802331,957687,915094,875111,832466},
				{882981,867664,896820,809482,923023},
				{829415,814512,940226,978115,831827},
				{806232,837813,961698,844056,983721},
				{923071,972399,982766,907131,850043},
				{822380,818586,871538,983745,960983,888003,964137,810508,899267,973336},
				{900100,982013,808539,976012,951908,845870,821011,870749,835719,886450},
				{838102,882622,987311,850465,853342,924716,844930,821971,847907,921772},
				{960016,863774,990144,845274,819333,989933,990153,959626,915206,820545},
				{804154,989730,955129,987771,980677,943257,812049,869455,911280,997259},
				{914490,957061,893002,957989,900964,988645,967661,956006,920414,862668},
				{861248,833995,928360,905682,825217,819327,966070,921564,807581,962290},
				{957683,939387,929149,876470,949392,911001,816772,936305,874797,818163},
				{806342,944111,889814,947927,923905,816274,952687,933739,866972,851059},
				{927477,808550,854154,941801,808248,837432,905868,994125,928239,895436},
				{988355,859418,943243,85,31,908839,5,967426,81,76},
				{920885,96,93,81,91,910368,815514,859321,10,981845},
				{44,912531,853040,12,960455,34,47,950435,88,863403},
				{73,922852,948456,834894,2,960106,78,65,842099,94},
				{803747,907241,93,48,909454,6,831646,39,51,992766},
				{876093,972202,49,81,880075,870892,80,54,953444,70},
				{98,920283,65,72,926740,84,850577,61,971311,876298},
				{55,951463,27,65,51,931780,802803,822026,858115,2},
				{921210,76,96,56,883540,45,802952,875906,897253,13},
				{959601,94,79,907610,74,930570,925235,100,51,912353},
				{57,990272,83,72,872502,9,93,902753,959862,914956},
				{932080,13,918249,845303,11,952276,18,865247,47,72},
				{861980,903396,83,35,944843,28,20,835860,11,826473},
				{936501,832727,66,8,42,52,55,956372,985537,917775},
				{847993,36,36,69,968095,945997,94,941853,963485,29},
				{823023,909096,962680,41,41,54,883159,848431,94,0},
				{946709,91,23,949782,863270,74,851065,92,39,930297},
				{837100,803780,860731,994749,69,84,9,27,29,988495},
				{29,802154,817777,71,24,53,960860,991250,900741,90},
				{879442,44,71,909470,55,830018,953556,870500,71,48},
				{128045,198660,195045,292430,938475,848800,658025,18395,285990},
				{105845,925965,42160,838685,448125,867103,278575,425151,715515,408045},
				{348100,453269,401085,893840,905165,306894,636900,922294,718150},
				{100630,63625,778340,311801,963520,43070,47584,476250,681507,550577},
				{491085,978917,858207,935090,442655,382695,788275,108640,460810,548910},
				{501580,624375,760010,976280,850614,3461,238315,948471,122520},
				{35065,514755,37685,48695,966305,737615,768375,159990,984840,275120},
				{531255,280470,150040,191880,883375,779620,215615,391315,941299},
				{11965,264895,180705,438700,341955,152125,970615,108987,376215},
				{385589,222710,550825,8590,470980,857260,871945},
				{548095,171865,541530,47860,52915,556140,345710},
				{497425,532135,891590,115850,321655,141230,319363},
				{131145,824840,61682,750820,456200,448650,805700,406905,285575,296420},
				{658160,57975,655620,73875,868865,157425,221280,230000,303105,788835},
				{129505,225175,889478,183482,497060,601970,216510,328200,719735},
				{633558,9235,550805,186875,950260,693970,626480,312052,355210},
				{289493,206540,873310,579285,292110,75415,518399,277095,531205,201726},
				{4600,186240,633895,291565,880145,415980,510677,571620},
				{292940,358186,173775,618978,554415,145015,744130,263230,998825},
				{894815,519560,841626,226210,238400,861200,551280,305785,544815},
				{42173,442414,28217,528438,806372,831256,52691,469314,527242},
				{648135,857252,707497,674046,907447},
				{654777,56384,576619,28417,388568,631976,468675},
				{607408,233855,467335,999846,970166,891046,186959,190439,647967},
				{412288,567395,46370,807131,318180,747962},
				{346635,30738,802843,518662,83440},
				{34164,676647,72118},
				{67490,35919,955396,896463,760949,602740,657628,626224,85892,272851}
		};

		for(int i=0;i<testcase.length;i++){

			//合計フラグの初期化
			sum=0;

			//フラグ配列の初期化
			for(int j=0;j<10;j++){
				flag[j]=0;
			}

			//turnの初期化
			turn[i]=0;

			//全要素の末尾が0もしくは5になるまで各要素単位への処理を繰り返す
			while(sum!=testcase[i].length){

				sum=0;

				//フラグ配列の初期化
				for(int j=0;j<10;j++){
					flag[j]=0;
				}

				//とにかく1/2にする。
				for(int m=0;m<testcase[i].length;m++){
					if(testcase[i][m]==null){
						testcase[i][m]=0;
					}
					Opr = (Integer)testcase[i][m];
					testcase[i][m]=Opr/2;
				}
				turn[i]++;

				//各要素の末尾が0もしくは5であるかの判定処理
				for(int k=0;k<testcase[i].length;k++){
					if(flag[k]==0 && (String.valueOf(testcase[i][k]).endsWith("0")==true || String.valueOf(testcase[i][k]).endsWith("5")==true)){
						flag[k] =1;
					}
					sum += flag[k];
				}

				//1つでも末尾が0もしくは5の要素がある場合削除
				if(sum>0){
					for(int k=0;k<testcase[i].length;k++){
						if(flag[k]==1){
							testcase[i][k]=null;
						}
					}
					turn[i]++;
				}
			}
			//System.out.println(turn[i]);
		}
		return turn;
	}

	private static int[] Turn5(){
		int sumA = 0;
		int sumB = 0;
		int Opr = 0;
		int Opr2 =0;
		int[] flag = new int[10];
		int[] next = new int[10];
		int[] turn = new int[100];
		Object[][] testcase = {
				{10,11},
				{0,9,9},
				{81,67,83,86},
				{11,22,30},
				{0},
				{5},
				{999999},
				{1000000},
				{5,10},
				{0,10,11},
				{10,20,21,22,23},
				{422808,211404,761062,845625,491519},
				{13,64,68,17,19},
				{93,31,72,65,75},
				{84,99,41,25,93},
				{2,72,63,58,66},
				{62,79,49,98,67},
				{87,31,37,36,95},
				{65,15,12,43,91},
				{34,71,60,41,95},
				{96,54,69,16,96},
				{73,69,64,92,24},
				{4,69,91,97,20,90,21,62,90,13},
				{75,72,44,100,96,12,99,59,4,97},
				{0,79,30,83,46,56,61,49,60,89},
				{10,72,2,7,75,26,82,30,57,2},
				{73,41,24,43,21,42,76,26,24,9},
				{59,77,32,6,23,87,97,23,43,32},
				{100,20,12,96,63,16,14,21,90,31},
				{6,18,19,51,54,70,10,96,80,62},
				{31,11,54,88,48,22,41,17,23,91},
				{45,59,56,4,13,95,65,81,64,79},
				{990492,953221,920810,925284,861402},
				{899023,958739,958208,836961,925983},
				{911568,986679,994864,913816,813822},
				{956961,827371,995429,889788,892175},
				{839452,878345,954982,995491,834352},
				{802331,957687,915094,875111,832466},
				{882981,867664,896820,809482,923023},
				{829415,814512,940226,978115,831827},
				{806232,837813,961698,844056,983721},
				{923071,972399,982766,907131,850043},
				{822380,818586,871538,983745,960983,888003,964137,810508,899267,973336},
				{900100,982013,808539,976012,951908,845870,821011,870749,835719,886450},
				{838102,882622,987311,850465,853342,924716,844930,821971,847907,921772},
				{960016,863774,990144,845274,819333,989933,990153,959626,915206,820545},
				{804154,989730,955129,987771,980677,943257,812049,869455,911280,997259},
				{914490,957061,893002,957989,900964,988645,967661,956006,920414,862668},
				{861248,833995,928360,905682,825217,819327,966070,921564,807581,962290},
				{957683,939387,929149,876470,949392,911001,816772,936305,874797,818163},
				{806342,944111,889814,947927,923905,816274,952687,933739,866972,851059},
				{927477,808550,854154,941801,808248,837432,905868,994125,928239,895436},
				{988355,859418,943243,85,31,908839,5,967426,81,76},
				{920885,96,93,81,91,910368,815514,859321,10,981845},
				{44,912531,853040,12,960455,34,47,950435,88,863403},
				{73,922852,948456,834894,2,960106,78,65,842099,94},
				{803747,907241,93,48,909454,6,831646,39,51,992766},
				{876093,972202,49,81,880075,870892,80,54,953444,70},
				{98,920283,65,72,926740,84,850577,61,971311,876298},
				{55,951463,27,65,51,931780,802803,822026,858115,2},
				{921210,76,96,56,883540,45,802952,875906,897253,13},
				{959601,94,79,907610,74,930570,925235,100,51,912353},
				{57,990272,83,72,872502,9,93,902753,959862,914956},
				{932080,13,918249,845303,11,952276,18,865247,47,72},
				{861980,903396,83,35,944843,28,20,835860,11,826473},
				{936501,832727,66,8,42,52,55,956372,985537,917775},
				{847993,36,36,69,968095,945997,94,941853,963485,29},
				{823023,909096,962680,41,41,54,883159,848431,94,0},
				{946709,91,23,949782,863270,74,851065,92,39,930297},
				{837100,803780,860731,994749,69,84,9,27,29,988495},
				{29,802154,817777,71,24,53,960860,991250,900741,90},
				{879442,44,71,909470,55,830018,953556,870500,71,48},
				{128045,198660,195045,292430,938475,848800,658025,18395,285990},
				{105845,925965,42160,838685,448125,867103,278575,425151,715515,408045},
				{348100,453269,401085,893840,905165,306894,636900,922294,718150},
				{100630,63625,778340,311801,963520,43070,47584,476250,681507,550577},
				{491085,978917,858207,935090,442655,382695,788275,108640,460810,548910},
				{501580,624375,760010,976280,850614,3461,238315,948471,122520},
				{35065,514755,37685,48695,966305,737615,768375,159990,984840,275120},
				{531255,280470,150040,191880,883375,779620,215615,391315,941299},
				{11965,264895,180705,438700,341955,152125,970615,108987,376215},
				{385589,222710,550825,8590,470980,857260,871945},
				{548095,171865,541530,47860,52915,556140,345710},
				{497425,532135,891590,115850,321655,141230,319363},
				{131145,824840,61682,750820,456200,448650,805700,406905,285575,296420},
				{658160,57975,655620,73875,868865,157425,221280,230000,303105,788835},
				{129505,225175,889478,183482,497060,601970,216510,328200,719735},
				{633558,9235,550805,186875,950260,693970,626480,312052,355210},
				{289493,206540,873310,579285,292110,75415,518399,277095,531205,201726},
				{4600,186240,633895,291565,880145,415980,510677,571620},
				{292940,358186,173775,618978,554415,145015,744130,263230,998825},
				{894815,519560,841626,226210,238400,861200,551280,305785,544815},
				{42173,442414,28217,528438,806372,831256,52691,469314,527242},
				{648135,857252,707497,674046,907447},
				{654777,56384,576619,28417,388568,631976,468675},
				{607408,233855,467335,999846,970166,891046,186959,190439,647967},
				{412288,567395,46370,807131,318180,747962},
				{346635,30738,802843,518662,83440},
				{34164,676647,72118},
				{67490,35919,955396,896463,760949,602740,657628,626224,85892,272851}
		};


		for(int i=0;i<testcase.length;i++){

			//合計フラグの初期化
			sumA=0;
			sumB=0;

			//フラグ配列の初期化
			for(int j=0;j<10;j++){
				flag[j]=0;
				next[j]=0;
			}

			//turnの初期化
			turn[i]=0;

			//全要素の末尾が0もしくは5になるまで各要素単位への処理を繰り返す
			while(sumA!=testcase[i].length){

				sumA=0;
				sumB=0;

				//フラグ配列の初期化
				for(int j=0;j<10;j++){
					flag[j]=0;
					next[j]=0;
				}


				//末尾が0もしくは5であるかの判定処理
				for(int k=0;k<testcase[i].length;k++){
					if(flag[k]==0 && (String.valueOf(testcase[i][k]).endsWith("0")==true || String.valueOf(testcase[i][k]).endsWith("5")==true)){
						flag[k] =1;
					}
					sumA += flag[k];
				}

				//末尾が0もしくは1であるかの判定処理
				for(int k=0;k<testcase[i].length;k++){
					if(next[k]==0 && (String.valueOf(testcase[i][k]).endsWith("0")==true || String.valueOf(testcase[i][k]).endsWith("1")==true)){
						next[k] =1;
					}
					sumB += next[k];
				}

				//1つでも末尾が0もしくは5である場合は削除してturnを+1
				if(sumA>0){
					for(int n=0;n<testcase[i].length;n++){
						if(testcase[i][n]==null){
							testcase[i][n]=0;
						}
						Opr2 =(Integer)testcase[i][n];
						if(flag[n]==1 && sumA>sumB && Opr2>=100 ){
							testcase[i][n]=null;
						}
						else{
							testcase[i][n]=Opr2/2;
						}
					}
					turn[i]++;
				}

				//違えば1/2にする。
				else{
					for(int m=0;m<testcase[i].length;m++){
						if(testcase[i][m]==null){
							testcase[i][m]=0;
						}
						Opr=(Integer) testcase[i][m];
						testcase[i][m]=Opr/2;
					}
					turn[i]++;
				}
			}
			//System.out.println(turn[i]);
		}
		return turn;
	}

	private static int[] Turn6(){
		int sumA = 0;
		int sumB = 0;
		int Opr = 0;
		int Opr2 = 0;
		int[] turn = new int[100];
		int[] flag = new int[10];
		int[] next = new int[10];

		Object[][] testcase = {
				{10,11},
				{0,9,9},
				{81,67,83,86},
				{11,22,30},
				{0},
				{5},
				{999999},
				{1000000},
				{5,10},
				{0,10,11},
				{10,20,21,22,23},
				{422808,211404,761062,845625,491519},
				{13,64,68,17,19},
				{93,31,72,65,75},
				{84,99,41,25,93},
				{2,72,63,58,66},
				{62,79,49,98,67},
				{87,31,37,36,95},
				{65,15,12,43,91},
				{34,71,60,41,95},
				{96,54,69,16,96},
				{73,69,64,92,24},
				{4,69,91,97,20,90,21,62,90,13},
				{75,72,44,100,96,12,99,59,4,97},
				{0,79,30,83,46,56,61,49,60,89},
				{10,72,2,7,75,26,82,30,57,2},
				{73,41,24,43,21,42,76,26,24,9},
				{59,77,32,6,23,87,97,23,43,32},
				{100,20,12,96,63,16,14,21,90,31},
				{6,18,19,51,54,70,10,96,80,62},
				{31,11,54,88,48,22,41,17,23,91},
				{45,59,56,4,13,95,65,81,64,79},
				{990492,953221,920810,925284,861402},
				{899023,958739,958208,836961,925983},
				{911568,986679,994864,913816,813822},
				{956961,827371,995429,889788,892175},
				{839452,878345,954982,995491,834352},
				{802331,957687,915094,875111,832466},
				{882981,867664,896820,809482,923023},
				{829415,814512,940226,978115,831827},
				{806232,837813,961698,844056,983721},
				{923071,972399,982766,907131,850043},
				{822380,818586,871538,983745,960983,888003,964137,810508,899267,973336},
				{900100,982013,808539,976012,951908,845870,821011,870749,835719,886450},
				{838102,882622,987311,850465,853342,924716,844930,821971,847907,921772},
				{960016,863774,990144,845274,819333,989933,990153,959626,915206,820545},
				{804154,989730,955129,987771,980677,943257,812049,869455,911280,997259},
				{914490,957061,893002,957989,900964,988645,967661,956006,920414,862668},
				{861248,833995,928360,905682,825217,819327,966070,921564,807581,962290},
				{957683,939387,929149,876470,949392,911001,816772,936305,874797,818163},
				{806342,944111,889814,947927,923905,816274,952687,933739,866972,851059},
				{927477,808550,854154,941801,808248,837432,905868,994125,928239,895436},
				{988355,859418,943243,85,31,908839,5,967426,81,76},
				{920885,96,93,81,91,910368,815514,859321,10,981845},
				{44,912531,853040,12,960455,34,47,950435,88,863403},
				{73,922852,948456,834894,2,960106,78,65,842099,94},
				{803747,907241,93,48,909454,6,831646,39,51,992766},
				{876093,972202,49,81,880075,870892,80,54,953444,70},
				{98,920283,65,72,926740,84,850577,61,971311,876298},
				{55,951463,27,65,51,931780,802803,822026,858115,2},
				{921210,76,96,56,883540,45,802952,875906,897253,13},
				{959601,94,79,907610,74,930570,925235,100,51,912353},
				{57,990272,83,72,872502,9,93,902753,959862,914956},
				{932080,13,918249,845303,11,952276,18,865247,47,72},
				{861980,903396,83,35,944843,28,20,835860,11,826473},
				{936501,832727,66,8,42,52,55,956372,985537,917775},
				{847993,36,36,69,968095,945997,94,941853,963485,29},
				{823023,909096,962680,41,41,54,883159,848431,94,0},
				{946709,91,23,949782,863270,74,851065,92,39,930297},
				{837100,803780,860731,994749,69,84,9,27,29,988495},
				{29,802154,817777,71,24,53,960860,991250,900741,90},
				{879442,44,71,909470,55,830018,953556,870500,71,48},
				{128045,198660,195045,292430,938475,848800,658025,18395,285990},
				{105845,925965,42160,838685,448125,867103,278575,425151,715515,408045},
				{348100,453269,401085,893840,905165,306894,636900,922294,718150},
				{100630,63625,778340,311801,963520,43070,47584,476250,681507,550577},
				{491085,978917,858207,935090,442655,382695,788275,108640,460810,548910},
				{501580,624375,760010,976280,850614,3461,238315,948471,122520},
				{35065,514755,37685,48695,966305,737615,768375,159990,984840,275120},
				{531255,280470,150040,191880,883375,779620,215615,391315,941299},
				{11965,264895,180705,438700,341955,152125,970615,108987,376215},
				{385589,222710,550825,8590,470980,857260,871945},
				{548095,171865,541530,47860,52915,556140,345710},
				{497425,532135,891590,115850,321655,141230,319363},
				{131145,824840,61682,750820,456200,448650,805700,406905,285575,296420},
				{658160,57975,655620,73875,868865,157425,221280,230000,303105,788835},
				{129505,225175,889478,183482,497060,601970,216510,328200,719735},
				{633558,9235,550805,186875,950260,693970,626480,312052,355210},
				{289493,206540,873310,579285,292110,75415,518399,277095,531205,201726},
				{4600,186240,633895,291565,880145,415980,510677,571620},
				{292940,358186,173775,618978,554415,145015,744130,263230,998825},
				{894815,519560,841626,226210,238400,861200,551280,305785,544815},
				{42173,442414,28217,528438,806372,831256,52691,469314,527242},
				{648135,857252,707497,674046,907447},
				{654777,56384,576619,28417,388568,631976,468675},
				{607408,233855,467335,999846,970166,891046,186959,190439,647967},
				{412288,567395,46370,807131,318180,747962},
				{346635,30738,802843,518662,83440},
				{34164,676647,72118},
				{67490,35919,955396,896463,760949,602740,657628,626224,85892,272851}
		};

		for(int i=0;i<testcase.length;i++){

			//合計フラグの初期化
			sumA=0;
			sumB=0;

			//フラグ配列の初期化
			for(int j=0;j<10;j++){
				flag[j]=0;
				next[j]=0;
			}

			//turnの初期化
			turn[i]=0;

			//全要素の末尾が0もしくは5になるまで各要素単位への処理を繰り返す
			while(sumA!=testcase[i].length){

				sumA=0;
				sumB=0;

				//フラグ配列の初期化
				for(int j=0;j<10;j++){
					flag[j]=0;
					next[j]=0;
				}

				//とにかく1/2にする。
				for(int m=0;m<testcase[i].length;m++){
					if(testcase[i][m]==null){
						testcase[i][m]=0;
					}
					Opr = (Integer)testcase[i][m];
					testcase[i][m]=Opr/2;
				}
				turn[i]++;

				//各要素の末尾が0もしくは5であるかの判定処理
				for(int k=0;k<testcase[i].length;k++){
					if(flag[k]==0 && (String.valueOf(testcase[i][k]).endsWith("0")==true || String.valueOf(testcase[i][k]).endsWith("5")==true)){
						flag[k] =1;
					}
					sumA += flag[k];
				}

				//末尾が0もしくは1であるかの判定処理
				for(int k=0;k<testcase[i].length;k++){
					if(next[k]==0 && (String.valueOf(testcase[i][k]).endsWith("0")==true || String.valueOf(testcase[i][k]).endsWith("1")==true)){
						next[k] =1;
					}
					sumB += next[k];
				}

				//1つでも末尾が0もしくは5の要素がある場合削除
				if(sumA>0){
					for(int k=0;k<testcase[i].length;k++){
						if(testcase[i][k]==null){
							testcase[i][k]=0;
						}
						Opr2 = (Integer)testcase[i][k];
						if(flag[k]==1 && sumA>sumB){
							testcase[i][k]=null;
						}
						else{
							testcase[i][k]=Opr2/2;
						}
					}
					turn[i]++;
				}
			}
			//System.out.println(turn[i]);
		}
		return turn;
	}
}


一人ゲームに向きになってしまい、他の問題は確認すらしていない状況でした。

今日の昼休憩にAndroid問題を見てやってみたら、30分くらいでできました。
こちらはコンテスト締切後に実施のため得点加算されていません。
マジで一人ゲームはパスしてこっちやっとけば良かったorz

この問題では2つのアプリを使います。問題用のアプリのサービスから自分で作ったアプリでコードをゲットするのです。

まずは問題用アプリを起動してメールアドレスとパスワードを入れて保存ボタンをタッチ

そうすると解答コードが保存されます。

そして自分の作ったアプリを起動して、AIDLでコードを取得します。ハッキングっぽくておもしろかったです。

それではソースコードです。
Main.Java

package com.google.android.apps.gddquiz;

import android.app.Activity;
import android.os.Bundle;
import com.google.android.apps.gddquiz.R;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;
import android.view.Gravity;
import android.widget.Toast;

public class Main extends Activity {
    /** Called when the activity is first created. */
	//サービスのインターフェイス宣言
	private IQuizService serviceIf;
	String tex;
	

	@Override
    public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        //サービスへのバインド処理
        Intent intent = new Intent(IQuizService.class.getName());
        bindService(intent, con, BIND_AUTO_CREATE);
    }

    //サービスの接続
    private ServiceConnection con = new ServiceConnection(){
    	//サービス接続処理
    	public void onServiceConnected(ComponentName name, IBinder service){
    		//サービスのインターフェイスを取得
    		serviceIf = IQuizService.Stub.asInterface(service);

    		try{
    			tex = serviceIf.getCode() ;
    			Toast toast = Toast.makeText(Main.this, "DevQuizアプリのコードはズバリ¥n"+tex+"だ!", Toast.LENGTH_LONG);
    			toast.setGravity(Gravity.CENTER, 0, 0);
    			toast.show();
    		}
    		catch (RemoteException e){
    			e.printStackTrace();
    		}
    	}
    	//サービス切断処理
    	public void onServiceDisconnected(ComponentName name){
    		serviceIf = null;
    	}
    };
}

IQuizService.aidl

package com.google.android.apps.gddquiz;

interface IQuizService {
  String getCode();
}

IQuizService.java(AIDLファイルを作ると自動生成される)

/*
 * This file is auto-generated.  DO NOT MODIFY.
 * Original file: /Users/haruo/Dropbox/MacDev/workspace/CodeGet/src/com/google/android/apps/gddquiz/IQuizService.aidl
 */
package com.google.android.apps.gddquiz;
public interface IQuizService extends android.os.IInterface
{
/** Local-side IPC implementation stub class. */
public static abstract class Stub extends android.os.Binder implements com.google.android.apps.gddquiz.IQuizService
{
private static final java.lang.String DESCRIPTOR = "com.google.android.apps.gddquiz.IQuizService";
/** Construct the stub at attach it to the interface. */
public Stub()
{
this.attachInterface(this, DESCRIPTOR);
}
/**
 * Cast an IBinder object into an com.google.android.apps.gddquiz.IQuizService interface,
 * generating a proxy if needed.
 */
public static com.google.android.apps.gddquiz.IQuizService asInterface(android.os.IBinder obj)
{
if ((obj==null)) {
return null;
}
android.os.IInterface iin = (android.os.IInterface)obj.queryLocalInterface(DESCRIPTOR);
if (((iin!=null)&&(iin instanceof com.google.android.apps.gddquiz.IQuizService))) {
return ((com.google.android.apps.gddquiz.IQuizService)iin);
}
return new com.google.android.apps.gddquiz.IQuizService.Stub.Proxy(obj);
}
public android.os.IBinder asBinder()
{
return this;
}
@Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
{
switch (code)
{
case INTERFACE_TRANSACTION:
{
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_getCode:
{
data.enforceInterface(DESCRIPTOR);
java.lang.String _result = this.getCode();
reply.writeNoException();
reply.writeString(_result);
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
private static class Proxy implements com.google.android.apps.gddquiz.IQuizService
{
private android.os.IBinder mRemote;
Proxy(android.os.IBinder remote)
{
mRemote = remote;
}
public android.os.IBinder asBinder()
{
return mRemote;
}
public java.lang.String getInterfaceDescriptor()
{
return DESCRIPTOR;
}
public java.lang.String getCode() throws android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
java.lang.String _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(Stub.TRANSACTION_getCode, _data, _reply, 0);
_reply.readException();
_result = _reply.readString();
}
finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
}
static final int TRANSACTION_getCode = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
}
public java.lang.String getCode() throws android.os.RemoteException;
}
˙

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.google.android.apps.gddquiz"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="10" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Main"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>

と、長くなってしまいましたがこんな感じです。
来年こそはGDD行けるように勉強しなくては。

それではお休みなさい。