import java.text.DecimalFormat;import java.util.Scanner;public class Main{ public static void main(String args[]){ Scanner scan = new Scanner(System.in); DecimalFormat df = new DecimalFormat("0"); while(scan.hasNext()){ String str[] = scan.nextLine().split(" "); int n = Integer.parseInt(str[0]); int m = Integer.parseInt(str[1]); int t = n; if(n>m) { n = m; m = t; } double sum_o = 0; double sum_j = 0; for(int i=n; i<=m; i++) { if(i%2 == 0) sum_o += Math.pow(i, 2); else sum_j += Math.pow(i, 3); } System.out.PRintln(df.format(sum_o)+" "+df.format(sum_j)); } }}
新闻热点
疑难解答