Submission #3621538


Source Code Expand

#include<stdio.h>
#include<math.h>

int main(void) {

	int A, N, i,x;
	double n;

	i =1;

	printf("N=");
	scanf_s("%d", &N);
	printf("\n");

	printf("A=");
	scanf_s("%d", &A);
	printf("\n");
	
	if (N < 500) {
		if (A > N) printf("YES");
		else printf("NO");

		return 0;
	}

	for (;;) {

		n = N / (500 * i);
		/*printf("↓計算中\n");
		printf("%f\n", n);
		printf("%d\n", i);
		*/
		i++;
		
		if (n = ceil(n)) 
			break;
	}
	int y = n;
	//printf("%d\n", y);
	x = N - 500 * y;

	//printf("%d\n", x);

	if (A >= x) printf("YES");
	else printf("NO");
	
	return 0;
}

Submission Info

Submission Time
Task A - Infinite Coins
User kopurei
Language C (Clang 3.8.0)
Score 0
Code Size 614 Byte
Status CE

Compile Error

./Main.c:12:2: warning: implicit declaration of function 'scanf_s' is invalid in C99 [-Wimplicit-function-declaration]
        scanf_s("%d", &N);
        ^
./Main.c:35:9: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
                if (n = ceil(n)) 
                    ~~^~~~~~~~~
./Main.c:35:9: note: place parentheses around the assignment to silence this warning
                if (n = ceil(n)) 
                      ^
                    (          )
./Main.c:35:9: note: use '==' to turn this assignment into an equality comparison
                if (n = ceil(n)) 
                      ^
                      ==
2 warnings generated.
/tmp/Main-0c0165.o: In function `main':
./Main.c:(.text+0x1b): undefined reference to `scanf_s'
./Main.c:(.text+0x42): undefined reference to `scanf_s'
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)