Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

论学好线代的重要性QWQ

Posted by YanXB at 2016-02-24 09:24:19 on Problem 1166
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const int shift[9][9]=
{
	{3,2,3,2,2,1,3,1,0},
	{3,3,3,3,3,3,2,0,2},
	{3,2,3,1,2,2,0,1,3},
	{3,3,2,3,3,0,3,3,2},
	{3,2,3,2,1,2,3,2,3},
	{2,3,3,0,3,3,2,3,3},
	{3,1,0,2,2,1,3,2,3},
	{2,0,2,3,3,3,3,3,3},
	{0,1,3,1,2,2,3,2,3}
};
int main(void)
{
	int in[9],ans[9]={0};
	int i,j;
	for(i=0;i<9;i++)
	{
		scanf("%d",&in[i]);
		in[i]=(4-in[i])%4;
	}
	for(i=0;i<9;i++)
		for(j=0;j<9;j++)
			ans[i]+=shift[i][j]*in[j];
	for(i=0;i<9;i++)
		for(j=0;j<ans[i]%4;j++)
			printf("%d ",i+1);
	printf("\n");
	return (0);
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator