Submission #20254

# Submission time Handle Problem Language Result Execution time Memory
20254 2016-09-08T06:55:39 Z gamebaboo 팩토리얼 세제곱들의 합 (YDX14_fact) C
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <math.h>

int main(){

	int a, k, n, t, s;
	scanf("%d", &n);
	scanf("%d", &k);

	s = 0;
	for (; ; n--)
	{
		if (n == 0)
		{
			s += 1;
			break;
		}
		else
		{
			for (t = n, a = n; t > 1; t--)
			{
				a *= (t - 1);
			}
			s += pow(a,k);
		}
		s %= 10;
	}

	printf("%d\n", s==10 ? 1:s);
	
	// 1 1 2 6 24

}

Compilation message

fact.c: In function 'main':
fact.c:7:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ^
fact.c:8:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &k);
  ^
/tmp/ccFieGyv.o: In function `main':
fact.c:(.text.startup+0x7d): undefined reference to `pow'
collect2: error: ld returned 1 exit status