-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
CodeForces/Contests/CodeforceContestes/src/practice/nineoo/OddDivisor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
CodeForces/Contests/CodeforceContestes/src/practice/nineoo/StrangePartition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} |