1. 程式人生 > >BZOJ 3609: [Heoi2014]人人盡說江南好

BZOJ 3609: [Heoi2014]人人盡說江南好

神分析......

https://blog.csdn.net/u010600261/article/details/53186407

#include<cstdio>
using namespace std;
int main(){
	int T;
	scanf("%d",&T);
	while (T--){
		int n,m;
		scanf("%d%d",&n,&m);
		int ans=n/m*(m-1);
		if (n%m) ans+=n%m-1;
		printf("%d\n",(ans&1)^1);
	}
	return 0;
}