USACO Silver 2016 January - Subsequences Summing to Sevens

Authors: Kevin Sheng, thetazero, Melody Yu

Official Analysis (Java)

Video Solution

Note: The video solution might not be the same as other solutions. Code in C++.

Implementation

Time Complexity: O(N)\mathcal{O}(N)

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int MOD = 7;
int main() {
freopen("div7.in", "r", stdin);

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!