Fancy Mouse
- -|||
对于连续的4个数,n,n+1,n+2,n+3,有+(n) - (n+1) - (n+2) + (n+3) = 0
所以4个4个去掉剩下来就{{1},{1,2},{1,2,3},空}这几种情况了。
很明显-1-2+3=0,-1+2=1。所以n模4余0、3的时候答案为0,否则答案为1。
……程序都有点不想贴出来了,这都写不出来的话就。。。
#include<iostream>
using namespace std;

int main()
{
    
int Lines,s;
    cin
>>Lines;
    
for(;Lines>0;Lines--)
    
{
        cin
>>s;
        
if(s%4 == 0 || s%4 == 3) cout<<0<<endl;
        
else cout<<1<<endl;
    }

}
posted on 2005-09-24 13:08  Fancy Mouse  阅读(224)  评论(1编辑  收藏  举报