# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
659147 | zhing_zhou | Timovi (COCI18_timovi) | Java | 976 ms | 21156 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import java.util.*;
public class timovi
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
long n = sc.nextInt(), k = sc.nextInt(), m = sc.nextInt();
long var1 = m / (2 * n * k);
long a[] = new long[(int)(n)];
for(long i = 0; i < n; i++)
{
a[(int)(i)] = (2 * k) * var1;
}
m -= (2 * n * k) * var1;
long dir = 1, pos = 0;
while(m != 0)
{
a[(int)(pos)] += Math.min(k, m);
m -= Math.min(m, k);
pos += dir;
if(pos == n)
{
dir = -1;
pos += dir;
pos += dir;
}
}
for(long i = 0; i < n; i++)
{
System.out.print(a[(int)(i)] + " ");
}
System.out.println();
return;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |