제출 #95642

#제출 시각아이디문제언어결과실행 시간메모리
95642jeffGap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
inline unsigned long long mde(unsigned long long a, unsigned long long b, unsigned long long c) {
    unsigned long long s = 0, t = 0, y = 0, z = 0, i;
    stack<unsigned long long> st;
    while (b) st.push(b % 10), b /= 10;
    while (!st.empty()) {
        z *= 10;
        y *= 10;
        z += a * st.top();
        st.pop();
        y += z / 1000000000000000000;
        z %= 1000000000000000000;
    }
    t += y / c;
    y %= c;
    for (i = 0; i < 18; ++i) {
        y *= 10;
        z *= 10;
        t *= 10;
        y += z / 1000000000000000000;
        z %= 1000000000000000000;
        t += y / c;
        y %= c;
    }
    return t;
}

long long findGap(int T, int N) {
    long long l, r, y, z, ls = -1, rs = 0, a, b = 0, i;
    MinMax(0, 1000000000000000000, &y, &z);
    for (i = 0; i < N - 1; ++i) {
        a = y + mde(z - y, i, N - 1);
        b = y + mde(z - y, i + 1, N - 1) - 1;
        MinMax(a, b, &l, &r);
        if (l < 0 && r < 0) continue;
        if (ls > -1) rs = max(rs, l - ls);
        ls = r;
    }
	return max(rs, z - r);
}

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'long long unsigned int mde(long long unsigned int, long long unsigned int, long long unsigned int)':
gap.cpp:3:5: error: 'stack' was not declared in this scope
     stack<unsigned long long> st;
     ^~~~~
gap.cpp:3:5: note: suggested alternative: 'static'
     stack<unsigned long long> st;
     ^~~~~
     static
gap.cpp:3:11: error: expected primary-expression before 'unsigned'
     stack<unsigned long long> st;
           ^~~~~~~~
gap.cpp:4:15: error: 'st' was not declared in this scope
     while (b) st.push(b % 10), b /= 10;
               ^~
gap.cpp:4:15: note: suggested alternative: 't'
     while (b) st.push(b % 10), b /= 10;
               ^~
               t
gap.cpp:5:13: error: 'st' was not declared in this scope
     while (!st.empty()) {
             ^~
gap.cpp:5:13: note: suggested alternative: 't'
     while (!st.empty()) {
             ^~
             t
gap.cpp:2:24: warning: unused variable 's' [-Wunused-variable]
     unsigned long long s = 0, t = 0, y = 0, z = 0, i;
                        ^
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:29:5: error: 'MinMax' was not declared in this scope
     MinMax(0, 1000000000000000000, &y, &z);
     ^~~~~~
gap.cpp:35:27: error: 'max' was not declared in this scope
         if (ls > -1) rs = max(rs, l - ls);
                           ^~~
gap.cpp:38:9: error: 'max' was not declared in this scope
  return max(rs, z - r);
         ^~~