【AtCoder】ABC 483 A - Double-Sided Printing

A - Double-Sided Printing
AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online.
AtCoder
実行時間制限: 2 sec / メモリ制限: 1024 MiB / Difficulty: 16 / NoviSteps: 7Q / 配点: 100 点
問題概要
ページからなる資料をコピー用紙に両面印刷する。
ページを全て印刷するために必要なコピー用紙の枚数の最小値を求めよ。
制約
- 入力される値は整数
考察
求める必要な最小ページ数は で求められる。
実装例
CPP
1.#include <bits/stdc++.h>2.using namespace std;3. 4.template <class T1, class T2>5.inline auto div_ceil(T1 a, T2 b)6.{7. if (b < 0)8. a *= -1, b *= -1;9. if (a <= 0)10. return a / b;11. else12. return (a - 1) / b + 1;13.}14. 15.// ======================================== //16. 17.int main()18.{19. int N;20. cin >> N;21. 22. cout << div_ceil(N, 2) << endl;23. 24. return 0;25.}https://atcoder.jp/contests/abc483/submissions/80648805
atcoder.jp
実装時間: 5 分以内
コメント
まあやるだけ。





