// Test.cpp : Hey the name doesn't matter does it.
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
bool checkValid(const int SCORESc, const int SCORES[], const int score, const int i = 0) {
int remainder = score % SCORES[i];
if (remainder == 0) return true;
if (i < SCORESc - 1) {
while (remainder <= score) {
if (checkValid(SCORESc, SCORES, remainder, i + 1)) return true;
remainder += SCORES[i];
}
}
return false;
}
int main() {
int input;
cin >> input;
// suppose this line can be changed to include any game
// also, suppose the list is sorted
const int SCORES[4] = { 3, 6, 7, 8 };
if (checkValid(sizeof(SCORES) / sizeof(SCORES[0]), SCORES, input)) {
cout << "Valid Score" << endl;
} else {
cout << "Invalid Score" << endl;
}
return 0;
}
Ly8gVGVzdC5jcHAgOiBIZXkgdGhlIG5hbWUgZG9lc24ndCBtYXR0ZXIgZG9lcyBpdC4KCiNpbmNsdWRlIDxpb3N0cmVhbT4KdXNpbmcgc3RkOjpjaW47CnVzaW5nIHN0ZDo6Y291dDsKdXNpbmcgc3RkOjplbmRsOwoKYm9vbCBjaGVja1ZhbGlkKGNvbnN0IGludCBTQ09SRVNjLCBjb25zdCBpbnQgU0NPUkVTW10sIGNvbnN0IGludCBzY29yZSwgY29uc3QgaW50IGkgPSAwKSB7CglpbnQgcmVtYWluZGVyID0gc2NvcmUgJSBTQ09SRVNbaV07CglpZiAocmVtYWluZGVyID09IDApIHJldHVybiB0cnVlOwoJaWYgKGkgPCBTQ09SRVNjIC0gMSkgewoJCXdoaWxlIChyZW1haW5kZXIgPD0gc2NvcmUpIHsKCQkJaWYgKGNoZWNrVmFsaWQoU0NPUkVTYywgU0NPUkVTLCByZW1haW5kZXIsIGkgKyAxKSkgcmV0dXJuIHRydWU7CgkJCXJlbWFpbmRlciArPSBTQ09SRVNbaV07CgkJfQoJfQoJcmV0dXJuIGZhbHNlOwp9CgppbnQgbWFpbigpIHsKCWludCBpbnB1dDsKCWNpbiA+PiBpbnB1dDsKCgkvLyBzdXBwb3NlIHRoaXMgbGluZSBjYW4gYmUgY2hhbmd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