In our studio we design high quality polygonal 3d models for CNC machines or 3d printers according to your preferences.
Vendor: 3d-260656
Category: PATTERN
Reminder!
Order delivery time is 5-7 working days after payment
The link is sent to your email or messenger
Polylobus 1 .0 import java.util.Scanner; public class Polylobus { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = scanner.nextInt(); } int result = 0; for (int i = 0; i < n; i++) { int currentSum = 0; for (int j = i; j < n; j++) { currentSum += arr[j]; if (currentSum % k == 0) { result++; } } } System.out.println(result); } }
for CNC and 3D printers.