My issue
Time limit exceeded for this
My code
#include <stdio.h>
int main() {
// your code goes here
int t;
scanf("%d", &t);
while(t--){
int n, oc=0;
scanf("%d", &n);
if(n == 1){
printf("0\n");
}else{
for(int i=1;i<=n;i++){
for(int j = 1;j <= n; j++){
if((i%2 == 0 && j%2 != 0) || (i%2 != 0 && j%2 == 0)){
oc++;
}
}
}
printf("%d\n", oc);
}
}
}
Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300A/problems/ODDPAIRS