10分但判断d奇偶了求助
查看原帖
10分但判断d奇偶了求助
50604
良辰、楼主2022/2/28 16:04
#include <bits/stdc++.h>
#define int long long
using namespace std;

int t,n,a,d;

signed main(){
	ios::sync_with_stdio(0);
	cin>>t;
	while(t--){
		cin>>n>>a>>d;
		if(d%2==1){
			cout<<0<<endl;
			continue;
		}
		int las=a+(n-1)*d;
		int num=las-a-n+1;
		cout<<num<<endl;
	}
	return 0;
}
2022/2/28 16:04
加载中...