Skip to content

Commit 81b08cb

Browse files
committed
Add java solution for PairProgramming
1 parent b5e311f commit 81b08cb

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

pairprogramming/PROBLEM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pid='X'
44

55
problem(
6-
time_limit=1.0,
6+
time_limit=2.0,
77
id=pid,
88
title=pid + "Pair Programming",
99
#wiki_name="Your pukiwiki page name", # for wikify plugin
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.io.PrintWriter;
2+
import java.util.Scanner;
3+
4+
public class PairProgramming {
5+
private static final Scanner sc = new Scanner(System.in);
6+
private static final PrintWriter pw = new PrintWriter(System.out);
7+
8+
private static void solve() {
9+
final int n = sc.nextInt();
10+
int total = 0;
11+
for (int i = 0; i < n; i++) {
12+
final int ai = sc.nextInt();
13+
total += ai;
14+
pw.println(total % 2);
15+
}
16+
}
17+
18+
public static void main(final String[] args) {
19+
final int T = sc.nextInt();
20+
for (int i = 0; i < T; i++) {
21+
solve();
22+
}
23+
sc.close();
24+
pw.close();
25+
}
26+
}

pairprogramming/java-tossy/SOLUTION

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8; mode: python -*-
2+
3+
## Solution
4+
#c_solution(src='main.c') # -lm -O2 as default
5+
#cxx_solution(src='main.cc', flags=[]) # -std=c++11 -O2 as default
6+
java_solution(src='PairProgramming.java', encoding='UTF-8', mainclass='PairProgramming')
7+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main',
8+
# challenge_cases=[])
9+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main',
10+
# challenge_cases=['10_corner*.in'])
11+
#script_solution(src='main.sh') # shebang line is required
12+
#script_solution(src='main.pl') # shebang line is required
13+
#script_solution(src='main.py') # shebang line is required
14+
#script_solution(src='main.rb') # shebang line is required
15+
#js_solution(src='main.js') # javascript (nodejs)
16+
#hs_solution(src='main.hs') # haskell (stack + ghc)
17+
#cs_solution(src='main.cs') # C# (mono)
18+
19+
## Score
20+
#expected_score(100)

0 commit comments

Comments
 (0)