0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-20 16:45:24 +00:00
OI-codes/LibreOJ/5/data/spj_cpp.cpp

29 lines
703 B (Stored with Git LFS)
C++

#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream score_in("input");
ifstream std("answer");
ifstream usr("user_out");
long long score, answer, user_answer;
score_in >> score;
std >> answer;
usr >> user_answer;
if (!usr) {
cerr << "Failed to read any number from user output. Exiting." << endl;
cout << 0;
} else if (user_answer == 0) {
cerr << "Commiserations. Score is " << score << "." << endl;
cout << score;
} else if (user_answer == answer) {
cerr << "Correct!" << endl;
cout << 100;
} else {
cerr << "Sorry, incorrect date." << endl;
cout << 0;
}
}