codeforces 259-B. Little Elephant and Magic Square(数学)
2017-08-30 17:32
633 查看
http://codeforces.com/problemset/problem/259/B
九宫格里正中间的数等于任意旁边每一对数之和的一半。
九宫格里正中间的数等于任意旁边每一对数之和的一半。
#include<iostream> using namespace std; int main() { int n; cin>>n; while(n--) { int a[5][5]; for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin>>a[i][j]; a[1][1]=(a[0][1]+a[2][1])/2; a[0][0]=3*a[1][1]-(a[0][1]+a[0][2]); a[2][2]=3*a[1][1]-(a[0][2]+a[1][2]); for(int i=0;i<3;i++) { for(int j=0;j<2;j++) cout<<a[i][j]<<" "; cout<<a[i][2]<<endl; } } return 0; }
相关文章推荐
- B. Little Elephant and Magic Square
- Codeforces Round #157 (Div. 2) B. Little Elephant and Magic Square
- CodeForces 204B - Little Elephant and Cards
- Codeforces 221 D. Little Elephant and Array
- CodeForces 715A. Plus and Square Root(数学,脑洞题)
- codeforces 711 B. Chris and Magic Square (简单)
- CodeForces 258C Little Elephant and LCM(数学推理)
- CodeForces 711B. Chris and Magic Square(水题)
- [广义后缀自动机] BZOJ 3473 字符串 & BZOJ 3277 串 & Codeforces 204E #129 (Div. 1) E. Little Elephant and Strings
- codeforces 711B - Chris and Magic Square(矩阵0位置填数)
- CodeForces 258 B.Little Elephant and Elections(数位DP+dfs)
- codeforces 258-E. Little Elephant and Tree 线段树,离线
- CodeForces 220B(B. Little Elephant and Array)
- Codeforces 221d D. Little Elephant and Array
- codeforces 221D Little Elephant and Array
- codeforces 221D Little Elephant and Array
- CodeForces-221B-Little Elephant and Numbers [枚举]
- Codeforces 711B. Chris and Magic Square
- CodeForces-204E:Little Elephant and Strings (广义后缀自动机求出现次数)
- Codeforces 258B - Little Elephant and Elections