# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
659145 | 2022-11-16T19:11:18 Z | zhing_zhou | Timovi (COCI18_timovi) | Java 11 | 0 ms | 0 KB |
import java.util.*; public class JuniorPrelims1 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(), m = sc.nextInt(); int var1 = m / (2 * n * k); int a[] = new int[n]; for(int i = 0; i < n; i++) { a[i] = (2 * k) * var1; } m -= (2 * n * k) * var1; int dir = 1, pos = 0; while(m != 0) { a[pos] += Math.min(k, m); m -= Math.min(m, k); pos += dir; if(pos == n) { dir = -1; pos += dir; pos += dir; } } for(int i = 0; i < n; i++) { System.out.print(a[i] + " "); } System.out.println(); } }