結果

問題 No.35 タイパー高橋
ユーザー tokustokus
提出日時 2021-11-21 13:26:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 1,833 bytes
コンパイル時間 3,535 ms
コンパイル使用メモリ 76,168 KB
実行使用メモリ 55,048 KB
最終ジャッジ日時 2023-09-04 22:10:38
合計ジャッジ時間 4,724 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
55,048 KB
testcase_01 AC 140 ms
54,964 KB
testcase_02 AC 147 ms
54,900 KB
testcase_03 AC 147 ms
54,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.stream.Stream;

class Main {
    public static void main(String[] args) {
        // no5();
        // no18();
        // no21();
        // no24();
        // no26();
        // no29();
        // no32();
        no35();
    }

// タイパー高橋
    private static void no35() {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        // 100円硬貨
        int n;
        // 時間
        int[] t;
        // 文字列
        String[] m;

        try {
            String L = reader.readLine();
            n = Integer.parseInt(L);

            t = new int[n];
            m = new String[n];

            for (int i = 0; i < n; i++) {
                String tm = reader.readLine();
                String[] array = tm.split(" ");
                t[i] = Integer.parseInt(array[0]);
                m[i] = array[1];
            }

            reader.close();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
        // 一文字あたりの入力時間
        double inputTime = 1000d / 12d;

        // 成功
        int typeOk = 0;

        // 打ち漏らし
        int typeMiss = 0;

        for (int i = 0; i < n; i++) {
            int typeCorrect = (int)(t[i] / inputTime);

            if (typeCorrect == 0) {
                typeMiss += m[i].length();
                continue;
            }

            if (m[i].length() <= typeCorrect) {
                typeOk += m[i].length();
            } else {
                typeOk += typeCorrect;
                typeMiss += m[i].length() - typeCorrect;
            }
        }

        System.out.println(typeOk + " " + typeMiss);
    }
}  
0