URI Solution 1250 - Kilo Man - Solution in C++ | Ad Hoc
URI Online Judge Solution Kiloman| Ad Hoc
URI Main Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1250
Problem Name: URI Problem 1250 Kilo man
Problem Number : URI Problem 1250 Solution
Online Judge : URI Online Judge Solution
Level: Ad Hoc
Solution Language : C plus plus
URI Solution 1250 Code in CPP:
#include <iostream> #include <vector> using namespace std; int main() { int n, t, x, counter; char p; cin >> n; for (int j = 0; j < n; ++j) { cin >> t; vector<int> tiros; vector<char> pulos; counter = 0;; for (int i = 0; i < t; ++i) { cin >> x; tiros.push_back(x); } for (int i = 0; i < t; ++i) { cin >> p; pulos.push_back(p); } for (int i = 0; i < t; ++i) { if((tiros[i] == 1 || tiros[i] == 2) && pulos[i] == 'S') counter++; if(tiros[i] > 2 && pulos[i] == 'J') counter++; } cout << counter << endl; } return 0; }
No comments:
Write commentsTo know more about the problem, give us your valuable commment. We'll try to help you. Thanks