{{{~cpp #include using namespace std; struct InputData { int s; int f; int k; }; InputData* inputData; bool *outputData; int numberOfData; void input() { cin >> numberOfData; inputData = new InputData[numberOfData]; outputData = new bool[numberOfData]; for(int i = 0;i < numberOfData;i++) cin >> inputData[i].s >> inputData[i].f >> inputData[i].k; } void process() { int count; for(int i =0;i < numberOfData;i++) { count = inputData[i].f - inputData[i].s - 1; if(inputData[i].s % 2 == 0) count -= 1; if( ((count / inputData[i].k) % 2 == 1 && (count % inputData[i].k) == 0) || ((count / inputData[i].k) % 2 == 0 && (count % inputData[i].k) != 0)) outputData[i] = true; else outputData[i] = false; } } void output() { for(int i = 0;i < numberOfData;i++) cout << outputData[i] << "\n"; delete [] inputData; delete [] outputData; } void main() { input(); process(); output(); } }}} ---- 위의 코드는 옳은 코드가 아닙니다. 다시 한 번 잘 생각해 보세요. (예컨대, {{{~cpp (6,14,5)}}}에 대해 실험해 보길) 이런 문제는 MEA를 쓰면 쉽습니다. --JuNe ''MEA가 뭐에여...? 알고리즘인가요..? --["상규"]'' Means Ends Analysis라고 하는데 일반적인 문제 해결 기법 중 하나다. 하노이 탑 문제가 전형적인 예로 사용되지. 인지심리학 개론 서적을 찾아보면 잘 나와있다. 1975년도에 튜링상을 받은 앨런 뉴엘과 허버트 사이먼(''The Sciences of the Artificial''의 저자)이 정립했지. --JuNe ---- ["2002년도ACM문제샘플풀이"]