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
dimitar's solution for 300: Integer Pair, written in Java
public class IntegerPair { public int count(int n) { int ret = 0; for (int i=n; ; i--) { boolean ok = false; String t = Integer.toString(i); if (t.length() > 1) for (int j=0; j<t.length(); j++) { String s = t.substring(0,j) + t.substring(j+1,t.length()); int k = Integer.parseInt(s); if (i+k == n) { ++ret; ok = true; break; } if (i+k >= n) ok = true; } if (!ok) break; } return ret; } }