Codeforces 501 A. Contest Solution
Solve In c++:
///AH Tonmoy
///Islamic University,Bangladesh;
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,x,x1,y,y1,r,r1;
while(cin>>a>>b>>c>>d)
{
x=3*a/10;
y=a-((a/250)*c);
r=max(x,y);
x1=3*b/10;
y1=b-((b/250)*d);
r1=max(x1,y1);
if(r<r1)
cout<<"Vasya"<<endl;
else if(r1<r)
cout<<"Misha"<<endl;
else if(r==r1)
{
cout<<"Tie"<<endl;
}
}
return 0;
}
///AH Tonmoy
///Islamic University,Bangladesh;
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,x,x1,y,y1,r,r1;
while(cin>>a>>b>>c>>d)
{
x=3*a/10;
y=a-((a/250)*c);
r=max(x,y);
x1=3*b/10;
y1=b-((b/250)*d);
r1=max(x1,y1);
if(r<r1)
cout<<"Vasya"<<endl;
else if(r1<r)
cout<<"Misha"<<endl;
else if(r==r1)
{
cout<<"Tie"<<endl;
}
}
return 0;
}
No comments