Last active
February 20, 2022 09:39
-
-
Save Blinhy0131/da2bec7162dc9bd005e9be9b84477c43 to your computer and use it in GitHub Desktop.
sigma 求和
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 | |
8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void main(){ | |
int k,x,p=1,sum=0,ans; | |
float sig=0; | |
FILE *fpr=fopen("d.txt","r"); | |
fscanf(fpr,"%d\n %d",&x,&k); | |
for (int i=1;i<=k;i++){ | |
sum=i; | |
for(int t=sum-1;t>0;t--){ | |
sum=sum*t; | |
} | |
sig=sig+pow (x,i)/sum; | |
} | |
ans=(int)sig; | |
printf("%d\n",ans); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment