---
# System prepended metadata

title: Can You Solve It?
tags: [UVA]

---

# Can You Solve It?
題目連結 [UVA 10642](https://onlinejudge.org/external/106/10642.pdf)


## 中文簡述
輸出走過幾個座標格子

## solution:
```
#include<bits/stdc++.h>
using namespace std;
int loc(int x,int y)
{
	return (x+y)*(x+y+1)/2+x;
}
int main()
{
	int i,j=0,x,y,x2,y2,n,cnt;
	while(cin>>n)
	{
		for(i=0;i<n;i++)
		{
			cnt=0;
			cin>>x>>y>>x2>>y2;
			cout<<"Case "<<i+1<<": "<<loc(x2,y2)-loc(x,y)<<endl; 
		}
	}
}
```
###### tags: `UVA` 
回目錄 [學習筆記](/gIBZqAbWTCis7uOPp149gA)

