題目: 數數愛明明
import java.util.Scanner;
public class CountingTwo{
public static Scanner sc = new Scanner(System.in);
public static void main(String args[]){
while(sc.hasNext()){
Long n = sc.nextLong();
Long f = ((1 + n)*n)/2;
Long g = (f*(n+2))/3;
System.out.println(f + " " + g);
}
}
}
沒有留言:
張貼留言