Skip to content

Instantly share code, notes, and snippets.

@Bekt
Created April 15, 2013 01:58
Show Gist options
  • Save Bekt/5385168 to your computer and use it in GitHub Desktop.
Save Bekt/5385168 to your computer and use it in GitHub Desktop.
Code Jam 2013, Problem C (small input)
import java.util.*;
import java.io.*;
public class C1 {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(new File("c1.in"));
int[] palin = {1, 4, 9, 121, 484};
int t = in.nextInt();
for(int i=1; i<=t; i++) {
int a = in.nextInt(), b = in.nextInt(), count = 0;
for (int j=0; j<palin.length; j++) {
if(palin[j] >= a && palin[j] <= b) {
count++;
}
}
System.out.printf("Case #%d: %d%n", i, count);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment