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

Re:这个思路有点想不出来....有谁能证明一下不??

Posted by huicpc39 at 2008-08-06 17:24:24 on Problem 2965
In Reply To:这个思路有点想不出来....有谁能证明一下不?? Posted by:crackerwang at 2007-10-15 22:52:02
可以,下面是我两次AC的代码,前一次算是证明吧
Problem: 2965  User: huicpc39 
Memory: 24K  Time: 45MS 
Language: C  Result: Accepted 

Source Code 
#include<stdio.h>
int main()
{char s[5];int i,j,k,st[4][4];
for(i=0;i<4;++i)for(j=0;j<4;++j)st[i][j]=0;
for(i=0;i<4;++i)
{scanf("%s",s);
for(j=0;j<4;++j)if(s[j]=='+')
{st[i][j]++;
for(k=0;k<4;++k)st[k][j]++;
for(k=0;k<4;++k)st[i][k]++;}}
for(i=0;i<4;++i)for(j=0;j<4;++j)st[i][j]%=2;
for(i=j=0;i<4;++i)for(k=0;k<4;++k)if(st[i][k])j++;
printf("%d\n",j);
for(i=0;i<4;++i)for(j=0;j<4;++j)if(st[i][j])printf("%d %d\n",i+1,j+1);
}
按照以上思路,直接生成结果。
Source Code

Problem: 2965  User: huicpc39 
Memory: 16K  Time: 0MS 
Language: C  Result: Accepted 

Source Code 
#include <stdio.h>
int s[16]={0x111f,0x222f,0x444f,0x888f,0x11f1,0x22f2,0x44f4,0x88f8,
           0x1f11,0x2f22,0x4f44,0x8f88,0xf111,0xf222,0xf444,0xf888};
int main()
{char c;int i,n,j;
n=i=j=0;
while((c=getchar())!=EOF)
if(c!=10)if(c=='+')n^=s[i++];else ++i;
for(i=0;i<16;++i)if(n&(1<<i))++j;printf("%d\n",j);
for(i=0;i<16;++i)if(n&(1<<i))printf("%d %d\n",i/4+1,i%4+1);}


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