是不是我想复杂了?悬关

P1597 语句解析

是的 ### AC Code ```cpp #include <bits/stdc++.h> using namespace std; int main() { int a = 0, b = 0, c = 0; string d; cin >> d; for (unsigned int i = 0; i < d.length() / 5; i++) { if (d[i * 5] == 'a') { if (d[i * 5 + 3] == 'a') a = a; else if (d[i * 5 + 3] == 'b') a = b; else if (d[i * 5 + 3] == 'c') a = c; else a = d[i * 5 + 3] % 48; } else if (d[i * 5] == 'b') { if (d[i * 5 + 3] == 'a') b = a; else if (d[i * 5 + 3] == 'b') b = b; else if (d[i * 5 + 3] == 'c') b = c; else b = d[i * 5 + 3] % 48; } else { if (d[i * 5 + 3] == 'a') c = a; else if (d[i * 5 + 3] == 'b') c = b; else if (d[i * 5 + 3] == 'c') c = c; else c = d[i * 5 + 3] % 48; } } cout << a << " " << b << " " << c; return 0; } ```
by 11514zbs @ 2024-02-23 13:38:14


我也不知道,这是哪题?
by zhrhh123456 @ 2024-02-23 13:47:06


@[lucy2012](/user/1252442) 我也不知道,这是哪题?
by zhrhh123456 @ 2024-02-23 13:47:49


@[zhrhh123456](/user/1267321) ???
by ln001 @ 2024-02-23 17:01:26


是的 ```cpp #include<bits/stdc++.h> using namespace std; string st;int a[10]; int main() { cin>>st; for(int i=0;i<st.size();i+=5)a[st[i]-'a']=st[i+3]>='0'&&st[i+3]<='9'?(st[i+3]-48):a[st[i+3]-'a']; for(int i=0;i<3;i++)cout<<a[i]<<' '; return 0; } ``` @[lucy2012](/user/1252442)
by czy0407 @ 2024-02-28 11:39:36


|