Advertisement
andruhovski

TaskA-2016

Apr 27th, 2016
2,114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. // taskA.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <fstream>
  7.  
  8. int _tmain(int argc, _TCHAR* argv[])
  9. {
  10.     std::ifstream ifs("input.txt");
  11.     int N, M, C=0;
  12.     char ch;
  13.  
  14.     ifs >> N >> M >> ch;
  15.  
  16.     if (ch == 'S')
  17.         C = M + 2;
  18.     else if (ch == 'W')
  19.         C = M + 1;
  20.     if (C > N) C = N;
  21.  
  22.     std::cout << C <<std::endl;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement