#include<iostream>
#include<string>
using namespace std;
int main(){
int t=0;
cin>>t;
while(t--){
string str;
cin>>str;
int a=0,b=0;
for(int i=0;i<3;i++){
a+=str[i]-'0';
}
for(int i=3;i<6;i++){
b+=str[i]-'0';
}
if(a==b) cout<<"yes\n";
else cout<<"no\n";
}
return 0;
}
写复杂了
#include<iostream>
#include<string>
using namespace std;
int main(){
int t=0;
cin>>t;
while(t--){
string str;
cin>>str;
if(str[0]+str[1]+str[2]==str[3]+str[4]+str[5]) cout<<"yes\n";
else cout<<"no\n";
}
return 0;
}