Submission #520049

# Submission time Handle Problem Language Result Execution time Memory
520049 2022-01-28T08:29:29 Z blue Palindrome-Free Numbers (BOI13_numbers) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
using namespace std;


long long pow9[19];

long long count(long long a) //count number of palindrome-free numbers in range [0, a]
{
    vector<int> digit;

    long long res = 0;

    while(a != 0)
    {
        digit.push_back(a % 10);
        a /= 10;
    }

    int l = digit.size();

    if(l == 0)
    {
        return 1;
    }
    else if(l == 1)
    {
        return digit[0] + 1;
    }
    else if(l == 2)
    {
        return digit[0] + 10*digit[1] - (digit[1] - (digit[0] < digit[1])); //digit[1] = multiples of 11 below
    }
    else
    {
        res += digit[0] + 1 - (digit[1] );
        res +=
    }

    return res;
}

int main()
{
    pow9[0] = 1;
    for(int i = 1; i < 19; i++) pow9[i] = pow9[i-1] * 9;

    long long a, b;
    cin >> a >> b;

    cout << count(b) - count(a-1) << '\n';

}

Compilation message

numbers.cpp: In function 'long long int count(long long int)':
numbers.cpp:38:5: error: expected primary-expression before '}' token
   38 |     }
      |     ^