Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
2104 张弛 将任何一个正整数的立方写成一组相邻奇数之和 C++ 运行出错 0 0 MS 192 KB 394 2019-11-08 18:14:48

Tests(0/9):


#include <stdio.h> #include <stdlib.h> #include <math.h> int main(){ int n, sum, i,x; printf("Please enter n大于10.\n"); scanf("%d", &n); sum = (int)pow((float)n, (float)3);//总和 x = (int)pow((float)n, (float)2) - n + 1;//第一项 for(i = 0; i < n; i++){ printf("%d\t", x + i * 2); } printf("\n"); system("pause"); }


测评信息: