题目的意思是已知等差数列和 图片说明 为 图片标题 ,项数n为m,公差d为2,求首项a1
#include<stdio.h>
#include<string.h>
int main(int argc, char const *argv[])
{
int m = 0;
char strb[999]={0};
while (scanf("%d", &m) != EOF)
{
memset(strb, 0x00, sizeof(strb));
int sum = m*m*m;
int a1= sum/m - (m - 1);
sprintf(strb, "%d", a1);
for (int i = 1; i < m; i++)
{
a1 += 2;
strcat(strb, "+");
sprintf(strb+strlen(strb), "%d", a1);
}
printf("%s\n", strb);
}
return 0;
}