`
200830740306
  • 浏览: 105934 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

还是水

阅读更多
import java.io.BufferedInputStream;
import java.util.Scanner;

/**
 * @author NC
 * Poj3086
 */
public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(new BufferedInputStream(System.in));
        int n = scan.nextInt();
        for (int i = 1; i <= n; i++) {
            int kk = scan.nextInt();
            if (kk == 1) {
                System.out.println(i + " 1 3");
                continue;
            }
            int sum = 0;
            int t = 1;
            for (int j = 2; j <= kk + 1; j++) {
                t += j;
                sum += (j - 1) * t;
            }
            System.out.println(i + " " + kk + " " + sum);
        }
    }
}


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics