6 5 求單鏈表結點的階乘和 15分

2021-10-05 04:39:39 字數 847 閱讀 2402

本題要求實現乙個函式,求單鏈表l結點的階乘和。這裡預設所有結點的值非負,且題目保證結果在int範圍內。

int factorialsum( list l );
其中單鏈表list的定義如下:

typedef struct node *ptrtonode;

struct node ;

typedef ptrtonode list; /* 定義單鏈表型別 */

#include #include typedef struct node *ptrtonode;

struct node ;

typedef ptrtonode list; /* 定義單鏈表型別 */

int factorialsum( list l );

int main()

printf("%d\n", factorialsum(l));

return 0;

}/* 你的**將被嵌在這裡 */

3

5 3 6

846
單位: 浙江大學

時間限制: 400 ms

記憶體限制: 64 mb

**長度限制: 16 kb

編譯器 (1)

int factorialsum( list l )

sum += s;

l = l->next;

} return sum;

}

PTA 6 5 求單鏈表結點的階乘和 15分

本題要求實現乙個函式,求單鏈表l結點的階乘和。這裡預設所有結點的值非負,且題目保證結果在int範圍內。函式介面定義 int factorialsum list l 其中單鏈表list的定義如下 typedef struct node ptrtonode struct node typedef ptr...

4 6 求單鏈表結點的階乘和 15分

本題要求實現乙個函式,求單鏈表l結點的階乘和。這裡預設所有結點的值非負,且題目保證結果在int範圍內。函式介面定義 int factorialsum list l 其中單鏈表list的定義如下 typedef struct node ptrtonode struct node typedef ptr...

4 6 求單鏈表結點的階乘和 15分

本題要求實現乙個函式,求單鏈表l結點的階乘和。這裡預設所有結點的值非負,且題目保證結果在int範圍內。int factorialsum list l 其中單鏈表list的定義如下 typedef struct node ptrtonode struct node typedef ptrtonode ...