Skip to content

Commit

Permalink
practice session
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohithv07 committed Jan 11, 2025
1 parent 78326b0 commit 6219127
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package practice.nineoo;

import java.util.Scanner;

/**
* @author rohithvazhathody 11-Jan-2025
*/
public class OddDivisor {

/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int test = sc.nextInt();
while (test-- > 0) {
long n = sc.nextLong();
if ((n & (n - 1)) == 0) {
System.out.println("NO");
}
else {
System.out.println("YES");
}
}
sc.close();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package practice.nineoo;

import java.util.Scanner;

/**
* @author rohithvazhathody 11-Jan-2025
*/
public class StrangePartition {

/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int test = sc.nextInt();
while (test-- > 0) {
int n = sc.nextInt();
long x = sc.nextLong();
long[] nums = new long[n];
long totalSum = 0;
for (int i = 0; i < n; i++) {
nums[i] = sc.nextLong();
totalSum += nums[i];
}
long minVal = (long) Math.ceil((double) totalSum / (double) x);
long maxVal = 0;
for (long num : nums) {
maxVal += Math.ceil((double) num / (double) x);
}
System.out.println(minVal + " " + maxVal);
}
sc.close();
}

}

0 comments on commit 6219127

Please sign in to comment.