/*
Tanzila Islam
Southeast University
mail : tanzilamohita@gmail.com
Problem Link : http://codeforces.com/gym/100796/problem/H
*/
#include<iostream>
using namespace std;
int main(){ long long int n,m; while(cin >> n >> m){ if(n>m) cout << m*(n+1) << endl; else
cout << n*(m+1) << endl; } return 0; }
Another Solution :
#include<iostream> using namespace std; int main(){ long long m, n; cin >> n >> m; if(m < n){ long long s = n; n = m; m = s; } long long ans = 0; ans = n * (m+1); cout << ans << endl; return 0; }
No comments:
Post a Comment