p1385.cpp

来自「高手写的所有acm例程 在acm.zju.edu.cn 上的题目的例程」· C++ 代码 · 共 25 行

CPP
25
字号
#include <stdio.h>

int     Ans ( int n , int m )
{
        int     x = 1 << 30 , half , equal;

        while ( m && n > m ) {
                while ( x >= m && x - ( x - m + 1 ) / 2 >= n ) x >>= 1;
                if ( m > x ) { n -= x; m -= x; continue; }
                if ( n - m >= x / 2 ) { n -= x / 2; continue; }
                return 0;
        }
        if ( m == 0 || n < m ) return 0;
        return 1;
}

main ()
{
        int     total , n , m;
        for ( scanf ( "%d" , &total ); total; total -- ) {
                scanf ( "%d%d" , &n , &m );
                printf ( "%d\n" , Ans ( n , m ));
        } 
}
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?