C++11 Help!
查看原帖
C++11 Help!
977778
__Harry_Haiyun__楼主2023/9/1 21:56

include <bits/stdc++.h>

define int long long

define iostream() ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

using namespace std;
const int maxn = 1e6+7;
const int MAXN = maxn / 2;
bool a = true,b = false,c = false;
signed main()
{
    iostream();
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++)
    {
    	switch (s[i])
    	{
    		case 'A':
    			a = !a;
    			b = !b;
    			break;
    		case 'B':
    			b = !b;
    			c = !c;
    			break;
    		case 'C':
    			a = !a;
    			c = !c;
		}
	}
	if (a) cout << 1;
	else if (b) cout << 2;
	else cout << 3;
 	return 0;
}
2023/9/1 21:56
加载中...