File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ /*echo "# Basic-Programming" >> README.md
2+ git init
3+ git add README.md
4+ git commit -m "first commit"
5+ git branch -M master
6+ git remote add origin https://github.com/AkankshaSingh14/Basic-Programming.git
7+ git push -u origin master*/
8+
9+
10+ import java .util .*;
11+ class TestClass
12+ {
13+ public static void main (String [] args )
14+ {
15+ Scanner input = new Scanner (System .in );
16+ int T = input .nextInt ();
17+ while (T > 0 )
18+ {
19+ int gBalloon = input .nextInt ();
20+ int pBalloon = input .nextInt ();
21+ int n = input .nextInt ();
22+ int solveA = 0 ;
23+ int solveB = 0 ;
24+ for (int i = 0 ; i < n ; i ++ )
25+ {
26+ int a = input .nextInt ();
27+ int b = input .nextInt ();
28+ if (a == 1 )
29+ solveA ++;
30+ if (b == 1 )
31+ solveB ++;
32+ }
33+ int x = Math .min (solveA , solveB )*Math .max (gBalloon , pBalloon );
34+ int y = Math .max (solveA , solveB )*Math .min (gBalloon , pBalloon );
35+ System .out .println ( x + y );
36+ T --;
37+ }
38+
39+ }
40+
41+ }
42+
You can’t perform that action at this time.
0 commit comments