I Had A Problem solving the "lucky?" problem. And I Need just a little bit of help to solve it.
--> this is the link to the problem : https://codeforces.me/contest/1676/problem/A
--> and this is my source code :
include
include
using namespace std;
int main(){ string num; int testCases,sum1,sum2;
cin>>testCases; for(int k=0;k<=testCases-1;k++){ cin>>num; for(int i=0;i<=2;i++){ sum1=sum1+num[i]; }//end for i - first 3-digits - for(int j=3;j<=5;j++){ sum2=sum2+num[j]; }//end for j - Second 3-digits - if(sum1==sum2){ cout<<"YES\n"; }//end if - sum1==sum2 - else { cout<<"NO\n"; }//end else }//end for k-test cases- return 0;
}//end main
So If Anybody can help I Would be super appreciative.