CF624div3-A. Add Odd or Subtract Even
A. Add Odd or Subtract Even
题目
AC代码
#include <iostream> #include <algorithm> #include <stdio.h> #include <set> #include <cmath> using namespace std; typedef unsigned long long ll; ll T; ll a,b; int main(){ cin>>T; while(T--){ scanf("%lld %lld",&a,&b); if(a == b) puts("0"); else if(a<b){ if(a%2 ^ b%2) puts("1"); else puts("2"); }else{ if(a%2 ^ b%2) puts("2"); else puts("1"); } } return 0; }