Monday, May 1, 2017

URI Solution - 1192 Paula's Mathematic Game - Solution in C++ | Ad Hoc, String

URI Solution - 1192 Paula's Mathematic Game - Solution in C++ | Ad Hoc, String


URI Online Judge Solution Paula's Mathematic Game | Ad Hoc


Problem Name: URI Problem Paula's Mathematic Game
Problem Number : URI - 1192
Online Judge : URI Online Judge Solution
Level: Ad Hoc
Solution Language : C plus plus

URI Solution 1192 Code in CPP:


#include <iostream>
using namespace std;

int main()
{
 int n, a_i, c_i, res;
 char a, b, c;

 cin >> n;

 for (int i = 0; i < n; ++i)
 {
  cin >> a >> b >> c;
  cin.ignore();

  a_i = a - '0';
  c_i = c - '0';

  if(a_i == c_i){
   res = a_i * c_i;
  }else{
   if(b >= 97 && b <= 122){
    res = a_i + c_i;
   }else{
    res = c_i - a_i;
   }
  }

  cout << res << endl;
 }

 return 0;
}

No comments:
Write comments

To know more about the problem, give us your valuable commment. We'll try to help you. Thanks

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.