Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.util.Locale;
- import java.util.Scanner;
- public class Challenge1 {
- static FileReader fr;
- static Scanner sc;
- static FileWriter fw;
- public static void openFiles(String inFile, String outFile) throws IOException {
- fr = new FileReader(inFile);
- fw = new FileWriter(outFile);
- sc = new Scanner(fr);
- sc.useLocale(Locale.US);
- }
- public static void closeFiles() throws IOException {
- sc.close();
- fw.close();
- fr.close();
- }
- public static void writeLine(String line) throws IOException {
- write(line + "\n");
- }
- public static void write(String str) throws IOException {
- System.out.print(str);
- fw.write(str);
- }
- public static void main(String[] args) throws Exception {
- openFiles("submitInput.txt", "output.txt");
- int t = sc.nextInt();
- for (int i = 1; i <= t; i++) {
- int n = sc.nextInt();
- int sumS = 0;
- for(int j = 1; j <= n; j++) {
- sumS += sc.nextInt();
- }
- int ans = sumS/8;
- if((sumS % 8) != 0) ans++;
- write("Case #"+i+": " + ans);
- writeLine("");
- }
- closeFiles();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement