Description

 

Input

输入包含不超过10000 组数据。每组数据包含6个整数r1, c1, r2, c2, r3, c3 (1<=r1, c1, r2, c2, r3, c3<=8). 三个格子A, B, C保证各不相同。

 

Output

对于每组数据,输出测试点编号和最少步数。

 

Sample Input

1 1 8 7 5 6
1 1 3 3 2 2

Sample Output

Case 1: 7
Case 2: 3

#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cstdio>
#include <set>
#include <math.h>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <ctime>
#define INF 0x3f3f3f3f
#define MAXN 100005
#define Mod 1000000007
using namespace std;


int main()
{
    int x,y,x1,y1,x2,y2,k=1;
    while(cin>>x>>y>>x1>>y1>>x2>>y2)
    {
        cout<<"Case "<<k++<<": ";
        if(y1-y == x1-x)
        {
            if( x2-x == y2-y )
            {
                if( x2-x>0 && x1-x>0 || x2-x<0 && x1-x<0 )
                    cout<<abs(y1-y)+1<<endl;
                else
                    cout<<abs(y1-y)<<endl;
            }
            else
                cout<<abs(y1-y)<<endl;
        }
        else
            cout<<max( abs(x1-x) , abs(y1-y) )<<endl;
    }
    return 0;
}
12-30 23:49