Register
|
Login
Home
News
Competitions
Practice
How to
Rankings
Calendar
Arena
CodeFu 2007
CodeFu'07 Highlights
Jazoon'07 Highlights
Schedule
Rules
Prizes
Results
Competitions
»
Main CodeFu Competitons
»
CodeFu 2007
»
Results
CodeFu 2007 Results
CodeFu Final Round Results
dragan_sahpaski's solution for 300: Integer Pair, written in Java
public class IntegerPair { public int remove(String A,int pos){ String a=A.substring(0,pos-1); String b=A.substring(pos,A.length()); String c=a+b; // System.out.println(c); return Integer.valueOf(c).intValue(); } public int count(int N) { int count=0; int[] array=new int[10000001]; for(int i=0;i<N/2;i++){ int a=N-i,b=i; String A=Integer.toString(a),B=Integer.toString(b); if(a>=10){ for(int k=1;k<=A.length();k++){ // System.out.println(a+" "+b); if(remove(A,k)==b) if(array[a]==0 && array[b]==0){ // System.out.println(a+" "+b); array[a]++;array[b]++; count++; }} } } return count; } }