소ê°� ¶
2005/02/19 Accepted 0:00.006 64
단순한 문ìž�ì—´ 비êµ�ë¬¸ì œë�¼ëŠ” ìƒ�ê°�ì�´ 들었다. Presentation Error와 Accepted 를 어떻게 하면 쉽게 êµ¬ë³„í• ìˆ˜ 있ì�„지를 ê³ ë¯¼í•˜ë‹¤ ìž…ë ¥ë°›ì�„때부터 숫ìž�를 따로 ìž…ë ¥ë°›ëŠ” ë°°ì—´ì�„ 만들어 주는 방법ì�„ ì�´ìš©í•˜ì˜€ë‹¤.
단순한 문ìž�ì—´ 비êµ�ë¬¸ì œë�¼ëŠ” ìƒ�ê°�ì�´ 들었다. Presentation Error와 Accepted 를 어떻게 하면 쉽게 êµ¬ë³„í• ìˆ˜ 있ì�„지를 ê³ ë¯¼í•˜ë‹¤ ìž…ë ¥ë°›ì�„때부터 숫ìž�를 따로 ìž…ë ¥ë°›ëŠ” ë°°ì—´ì�„ 만들어 주는 방법ì�„ ì�´ìš©í•˜ì˜€ë‹¤.
코드 ¶
~cpp
// no10188 - Automated Judge Script
#include <iostream>
#include <cstring>
using namespace std;
const int MAX = 100;
bool setString(char * s, char * sDigit);
int main()
{
char answer[MAX*MAX]; // ì •ë‹µ
char answerDigit[MAX];
char reply[MAX*MAX]; // 사용ìž� ì¶œë ¥
char replyDigit[MAX];
int count = 1;
while (true)
{
if (!setString(answer, answerDigit) || !setString(reply, replyDigit))
break;
cout << "Run #" << count++;
if (strcmp(answerDigit, replyDigit) != 0)
cout << ": Wrong Answer\n";
else if (strcmp(answer, reply) == 0)
cout << ": Accepted\n";
else
cout << ": Presentation Error\n";
}
return 0;
}
bool setString(char * s, char * sDigit)
{
int n;
cin >> n;
if (n == 0)
return false;
cin.get();
int nDigit, nChar, nReturn;
nDigit = nChar = nReturn = 0;
char c;
while (true)
{
c = cin.get();
if (c == '\n')
nReturn++;
if (nReturn == n)
break;
if (c >= '0' && c <= '9')
sDigit[nDigit++] = c;
s[nChar++] = c;
}
sDigit[nDigit] = '\0';
s[nChar] = '\0';
return true;
}










