Java教程

3.25

本文主要是介绍3.25,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

 

 

 1 #include<stdio.h>
 2 typedef struct{
 3     int element[50];
 4     int top;
 5 }Stack;
 6 void Init(Stack*S)
 7 {
 8     S->top=-1;
 9 }
10 void Push(Stack*S,int n)
11 {
12     S->element[++S->top]=n;
13 }
14 int Pop(Stack*S)
15 {
16     int e;
17     e=S->element[S->top--];
18     return e;
19 }
20 int Fn(int n)
21 {
22     Stack T;
23     int result=1;
24     int e;
25     Init(&T);
26     Push(&T,n);
27     while(T.top!=-1)
28     {
29         e=Pop(&T);
30         if(e)
31         {
32             result=result*e;
33             Push(&T,e/2);
34         }
35     }
36     return result;
37 }
38 int main()
39 {
40     int n;
41     scanf("%d",&n);
42     printf("%d",Fn(n));
43     return 0;
44 }

 

这篇关于3.25的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!