Codeforces Round #835 (Div. 4) A. Medium Number
Here are two ways to implement what’s given in the problem:
- Take input as an array [a1,a2,a3][a_1,a_2,a_3][a1,a2,a3], and sort it. Output the middle element.
- Write two if-statements. The first: if (a>b(a>b(a>b andandand ac)a>c)a>c), output aaa. Else, if (b>a(b>a(b>a andandand bc)b>c)b>c), output bbb. Else, output ccc.
#include
using namespace std;int main()
{int T=1;cin>>T;while(T--){int a[3];cin>>a[0]>>a[1]>>a[2];sort(a,a+3);cout<