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
bobi4597's solution for 300: Integer Pair, written in Java
public class IntegerPair { public int count(int n) { int count = 0; for(int x = Math.max(n/2 - 1,10); x <= n; ++x) { String s = ""+x; for(int i = 0; i < s.length(); ++i) { String t = ""; for(int j = 0; j < s.length(); ++j) if(j!=i) t += (""+s.charAt(j)); if(x + Integer.parseInt(t)==n) { ++count; break; } } } return count; } }