I am getting wrong answer in MULTHREE, but can not find the test case which might fail, can anybody help please?
Here is my code:
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
for(int i=0; i<t; i++){
int long long k;
int d0, d1;
cin >> k >> d0 >> d1;
int long long sum=d0+d1, units=(k-3)/4, leftover=(k-3)%4, last=(sum+(d0+d1)%10)%10;
if(k==3){
sum+=(d0+d1)%10;
}
else if(k>3){
sum+=(d0+d1)%10+units*20;
for(int j=0; j<leftover; j++){
sum+=last;
last=(last*2)%10;
}
}
if(sum%3==0){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
}
}