1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import java.util.Scanner; /** * UVA10783 */ public class UVA10783 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int time = sc.nextInt(); for (int i = 0; i < time; i++) { int n1 = sc.nextInt(), n2 = sc.nextInt(), sum = 0; for (int j = n1; j <= n2; j++) if ((j & 0x00000001) == 1) sum += j; System.out.printf("Case %d: %d\r\n", i + 1, sum); } sc.close(); } } |