top of page

CCC 2018 J2: Occupy parking

Simple if statement nested in a for loop that adds 1 to a variable (Occup) if they are both occupied (equal the char C). k is the number of spaces and day1/day2 are the parking spots for their respective days.

def compare(a,b,c):
    Occup = 0
    for i in range(c):
        if(a[i] == 'C' and a[i] == b[i]):

k = int(input())
day1 = input()
day2 = input()


Recent Posts

See All

CCC '24 J5 - Harvest Waterloo

#include<iostream> #include <vector> #include <algorithm> #include <cmath> #include <stack> using namespace std; int main() { int r, c, sr, sc; cin >> r; cin >> c; int p[r][c]; bool v

CCC '24 J4 - Troublesome Keys

#include <iostream> #include <string> #include <map> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main() { string ps; string ds; cin >> ps; cin >> ds;

CCC '22 J5 - Square Pool

#include<iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; bool rowcom(pair<int, int> a, pair<int, int> b){ return a.first < b.first; } bool colcom(pair<int,


bottom of page