File tree Expand file tree Collapse file tree 2 files changed +111
-0
lines changed
Codechef/JulyLongChallenge2021 Expand file tree Collapse file tree 2 files changed +111
-0
lines changed Original file line number Diff line number Diff line change 1+ package JulyLongChallenge2021 ;
2+
3+ import java .util .Scanner ;
4+
5+ public class A {
6+
7+ public static void main (String [] args ) {
8+
9+ Scanner sc = new Scanner (System .in );
10+
11+ int t = sc .nextInt ();
12+
13+ for (int tt = 0 ; tt < t ; tt ++) {
14+ int d = sc .nextInt ();
15+ int x = sc .nextInt ();
16+ int y = sc .nextInt ();
17+ int z = sc .nextInt ();
18+
19+ int ans = maximumProduction (d , x , y , z );
20+
21+ System .out .println (ans );
22+ }
23+ sc .close ();
24+ }
25+
26+ private static int maximumProduction (int d , int x , int y , int z ) {
27+ int ans1 = 7 * x ;
28+ int remainingDays = 7 - d ;
29+ int ans2 = (y * d ) + (z * remainingDays );
30+ return Math .max (ans1 , ans2 );
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ package JulyLongChallenge2021 ;
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 B {
10+
11+ public static void main (String [] args ) {
12+
13+ FastReader sc = new FastReader ();
14+ PrintWriter out = new PrintWriter (System .out );
15+
16+ int t = sc .nextInt ();
17+
18+ for (int tt = 0 ; tt < t ; tt ++) {
19+
20+ int g = sc .nextInt ();
21+ int c = sc .nextInt ();
22+
23+ int ans = (c * c ) / (2 * g );
24+
25+ System .out .println (ans );
26+ }
27+ out .close ();
28+ }
29+
30+ static class FastReader {
31+ BufferedReader br ;
32+ StringTokenizer st ;
33+
34+ FastReader () {
35+ br = new BufferedReader (new InputStreamReader (System .in ));
36+ }
37+
38+ String next () {
39+ while (st == null || !st .hasMoreElements ()) {
40+ try {
41+ st = new StringTokenizer (br .readLine ());
42+ } catch (IOException e ) {
43+ e .printStackTrace ();
44+ }
45+ }
46+ return st .nextToken ();
47+ }
48+
49+ int nextInt () {
50+ return Integer .parseInt (next ());
51+ }
52+
53+ long nextLong () {
54+ return Long .parseLong (next ());
55+ }
56+
57+ double nextDouble () {
58+ return Double .parseDouble (next ());
59+ }
60+
61+ String nextLine () {
62+ String str = "" ;
63+ try {
64+ str = br .readLine ();
65+ } catch (IOException e ) {
66+ e .printStackTrace ();
67+ }
68+ return str ;
69+ }
70+
71+ int [] readArray (int n ) {
72+ int [] temparr = new int [n ];
73+ for (int i = 0 ; i < n ; i ++) {
74+ temparr [i ] = nextInt ();
75+ }
76+ return temparr ;
77+ }
78+ }
79+ }
You canβt perform that action at this time.
0 commit comments