Friday 21 September 2012

SPOJ 11581. The Famous Clock Solution

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#define max(a,b) ((a>b)?a:b)                        //finding max
#define min(a,b) ((a<b)?a:b)                        //finding min
#define Max(a,b,c) max(a,max(b,c))                  //finding max between 3 numbers
#define Min(a,b,c) min(a,min(b,c))                  //finding min between 3 numbers
#define Pi acos(-1.0)                               //defining Pi for mathematical uses
#define Clear(a) memset(a,0,sizeof(a))              //clearing memory of an array
#define setfalse(a) memset(a,false,sizeof(a))       //setting the array into false
#define settrue(a) memset(a,true,sizeof(a))         //setting the array into true
#define clrstr(a) memset(a,'\0',sizeof(a))          //setting string array to null
#define open freopen("input.txt","r",stdin)         //opening input file
#define close freopen ("output.txt","w",stdout)     //opening output file
#define Case(a) printf("Case %d: ",a)               //printing case number
#define caseh(a) printf("Case #%d: ",a)             //printing case number having '#'
#define getcase(a) scanf("%d",&a)                   //scanning case number
#define caseloop(a,b) for(a=1;a<=b;a++)             //making case loop
#define EPS 1e-9                                    //small value for avoiding preccesion error
#define LL long long                                //long long short form
#define MX 1000000

using namespace std;

int main()
{
    string temp;
    int c=1;


    while (cin >> temp)
    {
        Case(c++);

        if (temp=="I")
            cout << "1\n";

        if (temp=="II")
            cout << "2\n";

        if (temp=="III")
            cout << "3\n";

        if (temp=="IV")
            cout << "4\n";

        if (temp=="V")
            cout<< "5\n";

        if (temp=="VI")
            cout << "6\n";

        if (temp=="VII")
            cout << "7\n";

        if (temp=="VIII")
            cout << "8\n";

        if (temp=="IX")
            cout << "9\n";

        if (temp=="X")
            cout << "10\n";

        if (temp=="XI")
            cout << "11\n";

        if (temp=="XII")
            cout << "12\n";
    }
    return 0;
}

No comments:

Post a Comment