結果

問題 No.32 貯金箱の憂鬱
ユーザー pyraninepyranine
提出日時 2020-12-14 18:47:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 1,727 bytes
コンパイル時間 1,549 ms
コンパイル使用メモリ 168,628 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 05:09:03
合計ジャッジ時間 2,286 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 3 ms
4,348 KB
testcase_04 AC 3 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 3 ms
4,348 KB
testcase_10 AC 3 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <unistd.h>

using namespace std;

using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t; using u16 = uint16_t; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using i128 = __int128_t; using u128 = __uint128_t; using f32 = float; using f64 = double;

#define cauto const auto&
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define ALL(x) (x).begin(),(x).end()

class Scanner {
    vector<char> buffer;
    ssize_t n_written;
    ssize_t n_read;

public:
    Scanner(): buffer(1024*1024) { do_read(); }

    int64_t read_int() {
        int64_t ret = 0, sgn = 1;
        int ch = current_char();
        while (isspace(ch)) { ch = next_char(); }
        if (ch == '-') { sgn = -1; ch = next_char(); }
        for (; isdigit(ch); ch = next_char())
            ret = (ret * 10) + (ch - '0');
        return sgn * ret;
    }

private:
    void do_read() {
        ssize_t r = read(0, &buffer[0], buffer.size());
        if (r < 0) {
            throw runtime_error(strerror(errno));
        }
        n_written = r;
        n_read = 0;
    }

    inline int next_char() {
        ++n_read;
        if (n_read == n_written) { do_read(); }
        return current_char();
    }

    inline int current_char() {
        return (n_read == n_written) ? EOF : buffer[n_read];
    }
};

int main() {
  Scanner scanner;
  int L = scanner.read_int();
  int M = scanner.read_int();
  int N = scanner.read_int();
  if (N >= 25) {
    M += N / 25;
    N %= 25;
  }
  if (M >= 4) {
    L += M / 4;
    M %= 4;
  }
  if (L >= 10) {
    L %= 10;
  }
  printf("%d\n", L + M + N);
  return 0;
}
0