Tuesday, January 6, 2015

Topcoder srm 637 div2 250point

These days ~

I feel like My coding skill is not improved.

I'm so depressed. but I will be a RED in topcoder
so have to be study very hard

My answer is  below

this is really easy~!!


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package srm637;

public class GreaterGameDiv2 {

 public static void main(String[] args) {
  GreaterGameDiv2 gg= new GreaterGameDiv2();
  int snuke[] = {3,5,9,16,14,20,15,17,13,2};
  int sothe[] = {6,18,1,8,7,10,11,19,12,4};
  
  System.out.println(gg.calc(snuke, sothe));
 }
 
 public int calc(int[] snuke, int[] sothe){
  int len = snuke.length;
  int total =0;
  for(int i=0; i<len; i++){
   if(snuke[i]>sothe[i]){
    total++;    
   }
  }
  
  return total;
 }

}

No comments:

Post a Comment