Re: 621 - Secret Research
Posted: Sun Jun 28, 2015 6:36 pm
My mind is blowing, I got 11 Runtime Error but I can't find where is the problem! Damn! And more important, I'm exactly sure: RE means that there was a problem while my program was running, right? Is possible to know which kind of error?
Please I'm going mad!
I did it both with regex and not, but still RE. D:
Please I'm going mad!
Code: Select all
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <regex>
int main (){
std::regex neg ("[0-9]*35");
std::regex failed ("9[0-9]*4");
std::regex notComp ("190[0-9]*");
std::string exper;
long long N;
scanf ("%lld", &N);
for (long long i=0; i<N; i++){
std::cin >> exper;
if (strcmp(exper.c_str(), "1") == 0 || strcmp(exper.c_str(), "4") == 0 || strcmp(exper.c_str(), "78") == 0){
std::cout << ((i==N-1)? "+" : "+\n");
continue;
}
if (std::regex_match(exper, neg)){
std::cout << ((i==N-1)? "-" : "-\n");
continue;
}
if (std::regex_match(exper, failed)){
std::cout << ((i==N-1)? "*" : "*\n");
continue;
}
if (std::regex_match(exper, notComp)){
std::cout << ((i==N-1)? "?" : "?\n");
continue;
}
}
return 0;
}