Skip to content

Commit e91abae

Browse files
authored
Merge pull request #54 from tossy310/remin/pair-programming
[WIP] Add solutions to Pair Programming
2 parents 3c35c03 + 4ceb96e commit e91abae

File tree

5 files changed

+94
-1
lines changed

5 files changed

+94
-1
lines changed

pairprogramming/PROBLEM

+1-1
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

pairprogramming/cpp-ryoissy/SOLUTION

+20
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='ryoissy-pairprogramming.cpp') # -std=c++11 -O2 as default
6+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main')
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)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <bits/stdc++.h>
2+
#define MOD 1000000007LL
3+
using namespace std;
4+
typedef long long ll;
5+
typedef pair<int,int> P;
6+
7+
void solve(){
8+
int n;
9+
scanf("%d",&n);
10+
int sum=0;
11+
for(int i=0;i<n;i++){
12+
int a;
13+
scanf("%d",&a);
14+
sum+=a;
15+
sum%=2;
16+
printf("%d\n",sum);
17+
}
18+
}
19+
20+
int main(void){
21+
int t;
22+
scanf("%d",&t);
23+
for(int i=0;i<t;i++){
24+
solve();
25+
}
26+
return 0;
27+
}
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

+20
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)