/ 科创班 /

记录详情

Wrong Answer

/in/foo.c:10:2: warning: return type defaults to 'int' [-Wimplicit-int]
  main()
  ^~~~
/in/foo.c: In function 'ff':
/in/foo.c:8:9: warning: 'f' may be used uninitialized in this function [-Wmaybe-uninitialized]
  return (f);
         ^
# 状态 耗时 内存占用
#1 Wrong Answer 2ms 256.0 KiB
#2 Wrong Answer 1ms 208.0 KiB
#3 Wrong Answer 2ms 256.0 KiB
#4 Wrong Answer 3ms 256.0 KiB
#5 Wrong Answer 2ms 256.0 KiB
#6 Wrong Answer 2ms 208.0 KiB
#7 Wrong Answer 2ms 256.0 KiB
#8 Wrong Answer 2ms 256.0 KiB
#9 Wrong Answer 2ms 256.0 KiB
#10 Wrong Answer 1ms 256.0 KiB

代码

#include<stdio.h>
long ff(int n)
{
	long f;
	if(n<0) printf("n<0,input error");
	else if(n==0||n==1) f=1;
	else f=ff(n-1)*n;
	return (f);
}
 main()
{
	int n;
	long y;
	printf("请输入一个整数:\n");
	scanf("%d",&n);
	y=ff(n);
	printf("%d!=%ld",n,y);
}

信息

递交者
类型
递交
题目
求阶乘
题目数据
下载
语言
C
递交时间
2018-06-18 23:31:07
评测时间
2018-06-18 23:31:07
评测机
分数
0
总耗时
23ms
峰值内存
256.0 KiB