腦殘.....
注意0!
Solution:
[c]
/* @file d487.c
* @date 10/21/2010
* @version v0.01
* @author "TXShon" <txshon@gmail.com>
* @note CreativeCommons(cc) 2010 TXShon, cc by-nc-nd
*
*Description
* Acm practice using c
*History
*/
#include <stdio.h>
int main()
{
int n, i, ans;
while(scanf("%d", &n)==1){
if(!n)printf("0! = 1 = 1\n");
else{
printf("%d! = %d ", n, n);
ans = n;
for( i=n-1; i>0; i--){
printf("* %d ", i);
ans*=i;
}
printf("= %d\n", ans);
}
}
return 0;
}
[/c]
沒有留言:
張貼留言