vakho

2011 - Episode I Problem A

Sep 25th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int R(0), num(0);
  8.  
  9.     ifstream ifs("rating.in");
  10.     ifs >> R;
  11.  
  12.     if (R % 2 == 0)
  13.     {
  14.         num = (R / 2);
  15.     }
  16.     else
  17.     {
  18.         num = (R % 2) + (R / 2);
  19.     }
  20.  
  21.     ofstream ofs("rating.out");
  22.     ofs << num;
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment