結果

問題 No.112 ややこしい鶴亀算
ユーザー yuya178yuya178
提出日時 2017-06-20 08:08:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 84 ms / 5,000 ms
コード長 2,219 bytes
コンパイル時間 2,295 ms
コンパイル使用メモリ 80,196 KB
実行使用メモリ 53,108 KB
最終ジャッジ日時 2024-04-10 06:24:35
合計ジャッジ時間 5,358 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
51,484 KB
testcase_01 AC 83 ms
51,500 KB
testcase_02 AC 83 ms
51,392 KB
testcase_03 AC 84 ms
51,356 KB
testcase_04 AC 84 ms
51,412 KB
testcase_05 AC 84 ms
51,336 KB
testcase_06 AC 83 ms
51,224 KB
testcase_07 AC 84 ms
51,356 KB
testcase_08 AC 83 ms
51,424 KB
testcase_09 AC 81 ms
51,348 KB
testcase_10 AC 83 ms
51,136 KB
testcase_11 AC 81 ms
51,364 KB
testcase_12 AC 81 ms
51,204 KB
testcase_13 AC 81 ms
51,160 KB
testcase_14 AC 81 ms
51,356 KB
testcase_15 AC 81 ms
51,340 KB
testcase_16 AC 82 ms
51,436 KB
testcase_17 AC 80 ms
51,360 KB
testcase_18 AC 81 ms
51,336 KB
testcase_19 AC 80 ms
51,016 KB
testcase_20 AC 84 ms
51,520 KB
testcase_21 AC 81 ms
50,892 KB
testcase_22 AC 81 ms
53,108 KB
testcase_23 AC 82 ms
51,300 KB
testcase_24 AC 80 ms
51,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int tsuru = 0;
            int kame = 0;
            int total = 0;
            int a[] = new int[N];
            for(int i=0; i<N; i++){
                a[i] = in.nextInt();
                total += a[i];
            }
            total = total/(N-1);
            for(int i=0; i<N; i++){
                if(total-a[i]==2) tsuru++;
                else kame++;
            }
            out.println(tsuru+" "+kame);

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}
0