A. Two Vessels

A. Two Vessels_第1张图片

A. Two Vessels_第2张图片 

#include
using namespace std;
#define int long long
//const int N=1e5+5;
int t,a,b,c;
signed main(){
	scanf("%lld",&t);
	while(t--){
		scanf("%lld%lld%lld",&a,&b,&c);
		int d=abs(a-b);
		if(d%2==0) d/=2;
		else d=d/2+1;
		if(d%c==0) printf("%lld\n",d/c);
		else printf("%lld\n",d/c+1);
	}
	return 0;
}

你可能感兴趣的:(codeforces,算法,c++,数据结构,开发语言,c语言)