?? ww.c
字號:
/*我不知道我這樣做合適不合適,好象自己在幫助別人干壞事
我不可能給你說得很細,學習到的東西是自己的,難道對自己
也可以作弊嗎?好好努力吧*/
#include<stdio.h>
#include <stdlib.h>
#include<malloc.h>
struct f //數據結構
{
double data;
struct f *next;
};
main()
{
int n;
scanf("%d",&n);
fun(n);
}
fun(n)
{
double y=0.00,x=1.00; //這里用雙精度實數定義可以容納更大的數據
struct f *head,*cthis,*a;
int number,i,j=0;
do{
a=(struct f*)malloc(sizeof(struct f));
if(head==NULL)
head=a;
else
{
cthis=head;
cthis=cthis->next;
}
cthis=a;
cthis->data=j; //這里定義存處在各個鏈表里的數據
//你可以用(int)rand()隨機數來代替j
number=cthis->data;
for(i=0;i<j;i++)
x=x*n;
y+=number*x;
j++;
}while(j<n);
printf("%.0lf",y);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -