Disclaimer: Make sure you tried enough before checking the solution
Problem: https://codeforces.com/group/MWSDmqGsZm/contest/219432/problem/S
#include<stdio.h> int main(){ int t,x,y,i,j,s; scanf("%d",&t); for(i=1;i<=t;i++){ scanf("%d%d",&x,&y); if(x<y){ s = 0; for(j=x+1;j<y;j++){ if(j%2==1){ s = s + j; } } } else if(y<x){ s=0; for(j=y+1;j<x;j++){ if(j%2==1){ s = s + j; } } } printf("%d\n",s); } return 0; }
Assiut University Training – Newcomers solution