由于P6994没有讨论区,故发在题目总版:
#include "testlib.h"
#include <string>
#include <cstring>
int p[100];
int n;
inline int getint()
{
int x = 0;
char c = ouf.readChar();
while (c > '9' || c < '0')
{
if (c == '\n' || c == '\r' || c == EOF)
{
return -1;
}
c = ouf.readChar();
}
while (c <= '9' && c >= '0')
{
x = x * 10 + c - '0';
c = ouf.readChar();
}
return x;
}
int main(int argc, char* argv[])
{
registerTestlibCmd(argc, argv);
std::string a = "", b = "";
a = inf.readString();
while (1)
{
int c = getint();
if (c == -1)
{
break;
}
if (c >= 100)
{
quitf(_wa, "Wrong Answer.");
return 0;
}
p[c] = 1;
b += std::to_string(c);
n++;
}
for (int i = 1; i <= n; i++)
{
if (!p[i])
{
quitf(_wa, "Wrong Answer.");
return 0;
}
}
if (a == b)
{
quitf(_ok, "Accepted.");
}
else
{
quitf(_wa, "Wrong Answer.");
}
return 0;
}
@chen_zhe