记录编号 172836 评测结果 AAAAAAAAAAA
题目名称 [USACO NOV]奶牛的锁 最终得分 100
用户昵称 Gravatar啊吧啦吧啦吧 是否通过 通过
代码语言 C++ 运行时间 0.004 s
提交时间 2015-07-27 11:51:54 内存使用 1.30 MiB
显示代码纯文本
#include <fstream>
#include <iostream>

using namespace std;

const int MAXN = 101;
bool t[MAXN][MAXN][MAXN] = {false};
int n, x[3], y[3], z[3], ans = 0;

main()
{
	ifstream fin("combo.in");
	ofstream fout("combo.out");
#define cin fin
#define cout fout
	ios::sync_with_stdio(false);
	cin >> n;
	
	if (n == 1){
		cout << 1;
		return 0;
	}	
	for (int i = 1; i <= 2; ++i){
		cin >> x[i] >> y[i] >> z[i];
		
		for (int a = x[i] - 2, d; a <= x[i] + 2; ++a){
			d = a;
			if (a <= 0)
				d += n;
			else if (a > n)
				d -= n;
			for (int b = y[i] - 2, e; b <= y[i] + 2; ++b){
				e = b;
				if (b <= 0)
					e += n;
				else if (b > n)
					e -= n;
				for (int c = z[i] - 2, f; c <= z[i] + 2; ++c){
					f = c;
					if (c <= 0)
						f += n;
					else if (c > n)
						f -= n;
					if (! t[d][e][f]){
						ans++;
						t[d][e][f] = true;
					}
				}
			}
		}
	}
	
	cout << ans;
}