답안 #117652

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
117652 2019-06-17T04:24:04 Z imsifile 백점을 받아랏! (FXCUP4_hundred) C++17
컴파일 오류
0 ms 0 KB
#include "hundred.h"
#include <algorithm>
using namespace std;

string bas, tmp; int mms[111], cc[3], fi;

void GetHundredPoints(int A, int B, int C) {
	for(int i=0; i<A; i++) bas += 'A';
	for(int i=0; i<B; i++) bas += 'B';
	for(int i=0; i<C; i++) bas += 'C';
	int bsc = Mark(bas);
	if(bsc == 100) return;

	for(int i=0; i<100; i++){
		if(bas[0]==bas[i]) continue;
		tmp=bas; swap(tmp[0], tmp[i]);
		int cha = Mark(tmp)-bsc;
		if(!cha) mms[i]=0;
		else if((cha+3)%3==1) mms[i]=(bas[i]-bas[0]+3)%3;
		else mms[i]=(bas[0]-bas[i]+3)%3;
	}
	for(int i=1; i<100; i++){
		if(bas[0]!=bas[i]) break;
		tmp=bas; swap(tmp[i], tmp[99]);
		int cha = Mark(tmp)-bsc;
		if(!cha) mms[i]=mms[99];
		else if((cha+3)%3==1) mms[i]=(mms[99]+bas[i]-bas[99]+3)%3;
		else mms[i]=(mms[99]+bas[99]-bas[i]+3)%3;
	}
	for(int i=0; i<100; i++) cc[mms[i]]++;
	if(cc[0]==A && cc[1]==B) fi=0;
	else if(cc[0]==B && cc[1]==C) fi=1;
	else fi=2;

	bas="";
	for(int i=0; i<100; i++) bas+="ABC"[(fi+mms[i])%3];
	Mark(bas);
}

Compilation message

hundred.cpp: In function 'void GetHundredPoints(int, int, int)':
hundred.cpp:7:6: error: ambiguating new declaration of 'void GetHundredPoints(int, int, int)'
 void GetHundredPoints(int A, int B, int C) {
      ^~~~~~~~~~~~~~~~
In file included from hundred.cpp:1:0:
hundred.h:3:13: note: old declaration 'std::__cxx11::string GetHundredPoints(int, int, int)'
 std::string GetHundredPoints(int A, int B, int C);
             ^~~~~~~~~~~~~~~~