10分蒟蒻

P1597 语句解析

## **说明/提示** 输入的 PASCAL 语言长度不超过 255。
by 威威多多 @ 2024-08-07 16:12:04


``` #include <bits/stdc++.h> using namespace std; int a,b,c; int main(){ string s; getline(cin,s); for (int i=0;i<s.size();i++) { if (s[i]=='a'){ if (isdigit(s[i+3])) a=s[i+3]-'0'; else{ if (s[i+3]=='b') a=b; if (s[i+3]=='c') a=c; } } if (s[i]=='b'){ if (isdigit(s[i+3])) b=s[i+3]-'0'; else{ if (s[i+3]=='a') b=a; if (s[i+3]=='c') b=c; } } if (s[i]=='c'){ if (isdigit(s[i+3])) c=s[i+3]-'0'; else{ if (s[i+3]=='b') c=b; if (s[i+3]=='a') c=a; } } } printf("%d %d %d",a,b,c); return 0; } ```
by gyx20141112 @ 2024-08-16 15:41:19


``` #include <bits/stdc++.h> using namespace std; int a,b,c; int main(){ string s; getline(cin,s); for (int i=0;i<s.size();i++) { if (s[i]=='a'){ if (isdigit(s[i+3])) a=s[i+3]-'0'; else{ if (s[i+3]=='b') a=b; if (s[i+3]=='c') a=c; } } if (s[i]=='b'){ if (isdigit(s[i+3])) b=s[i+3]-'0'; else{ if (s[i+3]=='a') b=a; if (s[i+3]=='c') b=c; } } if (s[i]=='c'){ if (isdigit(s[i+3])) c=s[i+3]-'0'; else{ if (s[i+3]=='b') c=b; if (s[i+3]=='a') c=a; } } } printf("%d %d %d",a,b,c); return 0; } ```
by chengxi13205537253 @ 2024-08-16 15:43:20


|