• Android

    Get all android stuffs here.You will find latest android news,tips,developers tools and resources here..

    Read More
  • Be an Expert in Programming

    Here you will find lot of programming books,tutorials,resources.Different tips and trick in programming.Common programming problems and their solve etc...

    Read More
  • Movies

    Get somethig eztra from this blog. Get all kinds of movie review,download link and much more

    Read More
Showing posts with label Uri 1366 solve. Show all posts
Showing posts with label Uri 1366 solve. Show all posts

Friday, 4 September 2015

URI Online Judge | 1250 KiloMan solve in C

#include<stdio.h>
#include<string.h>
int main()
{
    int hits[1000],i,testCase,numberOfHits,count=0;
    char position[10000];
    scanf("%d",&testCase);
    while(testCase--)
    {
        count=0;
        scanf("%d",&numberOfHits);
        for(i=0;i<numberOfHits;i++)
        {
            scanf("%d",&hits[i]);
        }
        scanf("%s",position);
        for(i=0;i<numberOfHits;i++)
        {
            if(hits[i]>0&&hits[i]<=2&&position[i]=='S')
            {
                count++;
            }
            else if(hits[i]>2&&position[i]=='J')
            {
                count++;
            }
        }
        printf("%d\n",count);
    }
    return 0;
}

URI Online Judge | 1366 Sticks Game solve in C

#include<stdio.h>
int main()
{
    int c,v,testCase,total,rectangle;
 
    do
    {
        scanf("%d",&testCase);
        if(testCase>0)
        {
            total=0;
            while(testCase--)
            {
                scanf("%d%d",&c,&v);
                if(v%2!=0)
                    total=total+(v-1);
                else
                    total=total+v;
            }
            rectangle=total/4;
            printf("%d\n",rectangle);
        }
 
    }
    while(testCase!=0);
    return 0;
}