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
npostolov's solution for 300: Integer Pair, written in Java
public class IntegerPair { public int count(int N) { int count = 0; for (int i=10;i<=N;i++){ String s = Integer.toString(i); String s1 = new String(); for (int k = s.length()-1;k >=0 ;k--){ s1 = s.substring(0,k) + s.substring(k+1); if (i + Integer.parseInt(s1)==N){ count++; break; } } } return count; } public static void main(String[] args) { IntegerPair obj = new IntegerPair(); System.out.println(obj.count(10)); } }