0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-05 12:18:48 +00:00
OI-codes/LibreOJ/2/data/spj_cpp.cpp

32 lines
801 B (Stored with Git LFS)
C++

#include <iostream>
#include <cctype>
#include <fstream>
#include <string>
int main() {
std::ifstream fout("user_out");
std::ifstream fans("answer");
std::string s1, s2;
std::getline(fout, s1);
std::getline(fans, s2);
bool ok = true;
if (s1.length() != s2.length()) {
std::cerr << "Output length differs." << std::endl;
ok = false;
} else {
for (size_t i = 0; i < s1.length(); i++) {
if (tolower(s1[i]) != tolower(s2[i])) {
std::cerr << "The " << i + 1 << "-th character differs. Expected '" << s2[i] << "'; got '" << s1[i] << "'." << std::endl;
ok = false;
}
}
}
if (ok) {
std::cerr << "OK!" << std::endl;
}
std::cout << (ok ? 100 : 0) << std::endl;
}