Skip to content

Commit 2fbdffa

Browse files
committed
solution of problem A, codeforces round 734, Div 3
1 parent b4ce071 commit 2fbdffa

File tree

1 file changed

+88
-0
lines changed
  • Codeforces/livecontest/Round734Div3

1 file changed

+88
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package livecontest.Round734Div3;
2+
3+
import java.io.PrintWriter;
4+
import java.io.BufferedReader;
5+
import java.io.InputStreamReader;
6+
import java.io.IOException;
7+
import java.util.StringTokenizer;
8+
9+
public class A {
10+
11+
public static void main(String[] args) {
12+
FastReader sc = new FastReader();
13+
PrintWriter out = new PrintWriter(System.out);
14+
15+
int t = sc.nextInt();
16+
for (int tt = 0; tt < t; tt++) {
17+
int n = sc.nextInt();
18+
solveTask(n, out);
19+
}
20+
21+
out.close();
22+
}
23+
24+
private static void solveTask(int n, PrintWriter out) {
25+
26+
int c1 = (n / 3);
27+
int c2 = (n - c1) / 2;
28+
29+
int left = n - (c1 + 2 * c2);
30+
c1 += left;
31+
32+
out.println(c1 + " " + c2);
33+
}
34+
35+
/*
36+
* private static long gcd(long a, long b) { if (b == 0) return a; return
37+
* gcd(b, a % b); }
38+
*/
39+
static class FastReader {
40+
BufferedReader br;
41+
StringTokenizer st;
42+
43+
FastReader() {
44+
br = new BufferedReader(new InputStreamReader(System.in));
45+
}
46+
47+
String next() {
48+
while (st == null || !st.hasMoreElements()) {
49+
try {
50+
st = new StringTokenizer(br.readLine());
51+
} catch (IOException e) {
52+
e.printStackTrace();
53+
}
54+
}
55+
return st.nextToken();
56+
}
57+
58+
int nextInt() {
59+
return Integer.parseInt(next());
60+
}
61+
62+
long nextLong() {
63+
return Long.parseLong(next());
64+
}
65+
66+
double nextDouble() {
67+
return Double.parseDouble(next());
68+
}
69+
70+
String nextLine() {
71+
String str = "";
72+
try {
73+
str = br.readLine();
74+
} catch (IOException e) {
75+
e.printStackTrace();
76+
}
77+
return str;
78+
}
79+
80+
int[] readArray(int n) {
81+
int[] temparr = new int[n];
82+
for (int i = 0; i < n; i++) {
83+
temparr[i] = nextInt();
84+
}
85+
return temparr;
86+
}
87+
}
88+
}

0 commit comments

Comments
Β (0)