-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathncmp.cpp
71 lines (58 loc) · 1.22 KB
/
ncmp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "testlib.h"
#include <sstream>
using namespace std;
string ending(long long x) {
x %= 100;
if (x / 10 == 1)
return "th";
if (x % 10 == 1)
return "st";
if (x % 10 == 2)
return "nd";
if (x % 10 == 3)
return "rd";
return "th";
}
string ltoa(long long n) {
stringstream ss;
ss << n;
string result;
ss >> result;
return result;
}
int main(int argc, char *argv[]) {
inf.init(argv[1], _input);
ouf.init(argv[2], _output);
ans.init(argv[3], _answer);
int n = 0;
string firstElems;
while (!ans.seekEof() && !ouf.seekEof()) {
n++;
long long j = ans.readLong();
long long p = ouf.readLong();
if (j != p) {
cout << "Incorrect" << endl << "0" << endl;
return 0;
} else if (n <= 5) {
if (firstElems.length() > 0)
firstElems += " ";
firstElems += ltoa(j);
}
}
int extraInAnsCount = 0;
while (!ans.seekEof()) {
ans.readLong();
extraInAnsCount++;
}
int extraInOufCount = 0;
while (!ouf.seekEof()) {
ouf.readLong();
extraInOufCount++;
}
if (extraInAnsCount > 0 || extraInOufCount > 0) {
cout << "Incorrect" << endl << "0" << endl;
return 0;
}
cout << "Correct" << endl << "100" << endl;
return 0;
}