Thursday, February 5, 2015

Solution of 228A. Is your horseshoe on the other hoof? (Codeforces)

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define sf scanf
#define pf printf
typedef long long ll;

int main()
{
    int count, ans;
    ll s1, s2, s3, s4;
    cin >> s1 >> s2 >> s3 >> s4;
    ans=0;
    count = 1;
    if(s1!=s2 && s1!=s3 && s1!=s4)
    {
        count++;
    }
    if(s2!=s3 && s2!=s4)
    {
        count++;
    }
    if(s3!=s4)
    {
        count++;
    }
    ans = (4-count);
    cout << ans << endl;
}

1 comment:

  1. I usually write hackerrank.com practice solutions . You can check it out!!! Only recently I have begun solving codeforces problems.
    https://aprogrammersexperience.blogspot.com/search/label/Hackerrank%20Solution

    ReplyDelete

Compare equality of two string in C

#include <stdio.h> #include<string.h> int main() {     char* country = "Bangladesh";     char* country2;     ...