我认为此题描述不清晰 输入样本不全面

P1597 语句解析

``` #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:40:57


``` #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:42:56


上一页 |