답안 #659146

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
659146 2022-11-16T19:11:44 Z zhing_zhou Timovi (COCI18_timovi) Java 11
20 / 80
929 ms 20308 KB
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();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 116 ms 11392 KB Output isn't correct
2 Incorrect 128 ms 11076 KB Output isn't correct
3 Correct 888 ms 19524 KB Output is correct
4 Correct 841 ms 19408 KB Output is correct
5 Incorrect 134 ms 10904 KB Output isn't correct
6 Runtime error 96 ms 10340 KB Execution failed because the return code was nonzero
7 Incorrect 881 ms 20308 KB Output isn't correct
8 Incorrect 929 ms 20116 KB Output isn't correct