Preprocessor Solution

Sort by

recency

|

186 Discussions

|

  • + 0 comments

    Since I found the exercise a bit unnecessary, I made some shortcuts to avoid using variables in some places. My solution is:

    #define toStr(X) "Result ="
    
    #define io(VEC) cin >> VEC
    
    #define FUNCTION(FUNNAME, OP)                       \
            void FUNNAME(int &m, int num){                   \
                if (num OP m){                                            \
                    m = num;                                               \
                }                                                                 \
            }                                                                     \
    
    
    #define foreach(V, I) for(int I = 0; I < n; I++)
    
    #define INF 999999
    
  • + 0 comments
    #define foreach(arg1, arg2) for(int i = 0; i < n; i++)
    #define io(arg) cin >> v
    
    #define INF 100000000
    
    
    #define minimum(arg1, arg2) if(arg1 > arg2) arg1 = arg2;
    #define maximum(arg1, arg2) if(arg1 < arg2) arg1 = arg2;
    
    #define FUNCTION(arg1, arg2) //
    
    #define toStr(arg) "Result ="
    
  • + 0 comments

    This has to be the worst defined problem that I had ever solved. Literally.

  • + 0 comments

    include #include

    include #define subtract(a,b) a-b

    int main() { int t;std::cin>>t; std::vector vec; for(int i=0, a;i>a, vec.push_back(a); auto maxi=std::max_element(vec.begin(),vec.end()), mini=std::min_element(vec.begin(),vec.end()); std::cout<<"Result = "<

  • + 0 comments
    #define toStr(x) #x
    #define io(v) cin >> v
    #define INF 100000000
    #define foreach(v, i) for(int i = 0; i < v.size(); i++)
    #define FUNCTION(name, op) void name(int& a, int b) { if (b op a) a = b; }