Submission #659146

#TimeUsernameProblemLanguageResultExecution timeMemory
659146zhing_zhouTimovi (COCI18_timovi)Java
20 / 80
929 ms20308 KiB
import java.util.*; public class timovi { 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(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...