andruhovski icon

TaskA-2016

andruhovski | PRO | 04/27/16 12:26:15 PM UTC | 0 ⭐ | 2462 👁️ | Never ⏰ | []
C++ |

390 B

|

None

|

0 👍

/

0 👎

// taskA.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include <iostream>
#include <fstream>
 
int _tmain(int argc, _TCHAR* argv[])
{
    std::ifstream ifs("input.txt");
    int N, M, C=0;
    char ch;
 
    ifs >> N >> M >> ch;
 
    if (ch == 'S')
        C = M + 2;
    else if (ch == 'W')
        C = M + 1;
    if (C > N) C = N;
 
    std::cout << C <<std::endl;
    return 0;
}

Comments