USACO Silver 2016 Open - Diamond Collector
Authors: Nathan Wang, Albert Ye
C++
C++ Implementation
1#include <bits/stdc++.h>23using namespace std;45int main() {6 freopen("diamond.in", "r", stdin);7 freopen("diamond.out", "w", stdout);89 int n, k; cin >> n >> k;10 int A[n];
Java
Java Implementation
Source: Nick Wu, from the official USACO editorial
1import java.io.*;2import java.util.*;3public class diamondS {4 public static void main(String[] args) throws IOException {5 BufferedReader br = new BufferedReader(new FileReader("diamond.in"));6 PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("diamond.out")));7 StringTokenizer st = new StringTokenizer(br.readLine());8 int n = Integer.parseInt(st.nextToken());9 int k = Integer.parseInt(st.nextToken());10 int[] list = new int[n];
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!