Submission #148160

# Submission time Handle Problem Language Result Execution time Memory
148160 2019-08-31T15:42:03 Z 연구맨(#3667, foja001) Get Hundred Points! (FXCUP4_hundred) C++17
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <stdlib.h>
#include "hundred.h"

static void my_assert(int TF, const char* message){
	if(!TF){ puts(message); exit(0); }
}

static int A = 0, B = 0, C = 0;
static std::string ans;
static int call_cnt = 0;
int Mark(std::string S){
	call_cnt++;
	my_assert(call_cnt <= 100, "Wrong: Too Much Calls");
	my_assert(S.size() == 100, "Wrong: Invalid S");

	int fin, As, Bs, Cs;
	fin = As = Bs = Cs = 0;
	for(int i = 0; i < 100; i++){
		my_assert(S[i] == 'A' || S[i] == 'B' || S[i] == 'C', "Wrong: Invalid S");
		if(S[i] == 'A') As++;
		if(S[i] == 'B') Bs++;
		if(S[i] == 'C') Cs++;
		if(S[i] == ans[i]) fin++;
	}
	my_assert(As == A && Bs == B && Cs == C, "Wrong: Invalid S");
	return fin;
}

int main(){
	char st[111];
	my_assert(scanf("%s", st) == 1, "Error: Invalid Input");
	ans = st;
	my_assert(ans.size() == 100, "Error: Invalid Input");

	for(int i = 0; i < 100; i++){
		if(ans[i] == 'A') A++;
		else if(ans[i] == 'B') B++;
		else if(ans[i] == 'C') C++;
		else my_assert(0, "Error: Invalid Input");
	}

	std::string you = GetHundredPoints(A, B, C);
	my_assert(ans == you, "Wrong: Wrong Answer");
	printf("Correct\n%d\n", call_cnt);
	return 0;
}

Compilation message

/tmp/ccakjhVp.o: In function `Mark(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x20): multiple definition of `Mark(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/tmp/cc5aBgeb.o:hundred.cpp:(.text+0x10): first defined here
/tmp/ccakjhVp.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc5aBgeb.o:hundred.cpp:(.text.startup+0x0): first defined here
/tmp/cc5aBgeb.o: In function `main':
hundred.cpp:(.text.startup+0x136): undefined reference to `GetHundredPoints[abi:cxx11](int, int, int)'
/tmp/ccakjhVp.o: In function `main':
grader.cpp:(.text.startup+0x45): undefined reference to `GetHundredPoints[abi:cxx11](int, int, int)'
collect2: error: ld returned 1 exit status