-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc2.java
executable file
·104 lines (87 loc) · 2.05 KB
/
c2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import java.util.*;
import java.io.*;
// public class Solution
class Solution
{
static BufferedReader br;
static String nextIntBuffer[];
static int nextIntBase;
static int nextInt() throws IOException {
return Integer.parseInt(next());
}
static long nextLong() throws IOException {
return Long.parseLong(next());
}
static String next() throws IOException {
if(nextIntBase>=nextIntBuffer.length) {
nextIntBase =0;
nextIntBuffer = br.readLine().split(" ");
}
return nextIntBuffer[nextIntBase++];
}
public static <T1 extends Comparable<T1> ,T2 extends Comparable<T2> > Pair<T1,T2> mp(T1 a,T2 b) {
return new Pair<T1,T2>(a,b);
}
static long mod=998244353;
public static void main(String[] args) throws IOException {
br=new BufferedReader(new InputStreamReader(System.in));
nextIntBuffer = new String[0];
int a=nextInt();
int b=nextInt();
int c=nextInt();
// for(int i=0;i<t;i++)
int n=0,m=0;
{
//frst
long count=1;
n=a+b;
m=Math.min(a,b);
count=(count*(comb(n,m)%mod))%mod;
n=c+b;
m=Math.min(c,b);
count=(count*(comb(n,m)%mod))%mod;
n=a+c;
m=Math.min(a,c);
count=(count*(comb(n,m)%mod))%mod;
System.out.println(count);
// System.out.println(((pow(2,a*b)*pow(2,b*c))%mod)*pow(2,a*c)%mod);
}
}
static long comb(int n,int m)
{
long num=fact(n)%mod;
long den=(fact(m)*fact(n-m))%mod;
long den_inv=pow(den,mod-2);
return (num*den_inv)%mod;
}
static long pow(long x,long y)
{
if(y==1) return x;
if(y==0) return 1;
long z=pow(x,y/2)%mod;
if(y%2==0)
return (z*z)%mod;
else
return (((x*z)%mod)*z)%mod;
}
static long fact(int n)
{
if(n==0) return 1;
else
return (n*(fact(n-1)%mod))%mod;
}
}
class Pair<T1 extends Comparable<T1>, T2 extends Comparable<T2> > implements Comparable<Pair<T1,T2> > {
T1 a;
T2 b;
public Pair(T1 x, T2 y) {
a = x; b = y;
}
@Override
public int compareTo(Pair<T1,T2> other) {
int comp1 = a.compareTo(other.a);
if(comp1!=0)
return comp1;
return b.compareTo(other.b);
}
}