Skip to content

CCC

The Canadian Computing Competition (CCC) is a fun challenge for students with an interest in programming. Designed to be both accessible to students with some programming experience and to challenge the keenest programmers at the secondary-school level, the CCC helps students build confidence and grow their ability to design, understand and implement algorithms.

See more from official site. Let's give it a try

J1

With what we have learned so far, we should be able to solve most J1 and J2 problems.

For example, let's take a look at J1 from 2020's contest.

Sample Solution for 2020-J1
2020-J1
#include <iostream>

using namespace std;

int main()
{
    int s, m, l;
    cin >> s >> m >> l;
    int score = (1 * s) + (2 * m) + (3 * l);
    if (score >= 10)
    {
        cout << "Happy" << endl;
    }
    else
    {
        cout << "sad" << endl;
    }

    return 0;
}

Similarly, J1 from 2021 and 2022 are both straightforward translation of formula. The key is to understand the problem statement.

Sample Solution for 2021-J1
2021-J1
#include <iostream>

using namespace std;

int main()
{
    int b;
    cin >> b;
    int p = 5 * b - 400;
    cout << p << endl;
    if (p == 100)
    {
        cout << 0 << endl;
    }
    else if (p < 100)
    {
        cout << 1 << endl;
    }
    else
    {
        cout << -1 << endl;
    }

    return 0;
}
Sample Solution for 2022-J1
2022-J1
#include <iostream>

using namespace std;

int main()
{
    int r, s;
    cin >> r >> s;
    cout << (8 * r + 3 * s) - 28 << endl;

    return 0;
}

J2

J2 is usually a bit more complex than J1. It's likely that you may at least use some forms of loops.

For example, let's take a look at J2 from 2022's contest.

Sample Solution for 2022-J2
2022-J2
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;

    int count = 0;
    for (int i = 0; i < n; i++)
    {
        int points, fouls;
        cin >> points >> fouls;
        int stars = (5 * points) - (3 * fouls);
        if (stars > 40)
        {
            count += 1;
        }
    }

    cout << count;
    if (count == n)
    {
        cout << "+";
    }
    cout << endl;

    return 0;
}

More Exercise

All the past contests can be found online. We can also use DMOJ to evaluate the solutions online.

Project Euler and Advent of Code are also good resources if you want to practice coding and problem solving skills.