解题思路
每次读入「数字 字符 数字 字符 数字」,忽略两个字符,判断前两个数字的和是否等于第三个数字即可。
参考代码
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin>>T;
while(T--)
{
int a,b,c;
char f;
cin>>a>>f>>b>>f>>c;
cout<<(a+b==c?"Right!":"Wrong!")<<'\n';
}
return 0;
}