20分选手求帮助

P1597 语句解析

**Is there any person?**
by Nina__happy @ 2024-07-30 21:43:10


@[meifan666](/user/1284088) 这题能也帮帮忙吗?QAQ
by Nina__happy @ 2024-08-02 22:20:10


@[Nina__happy](/user/1259513) 首先,输入怪怪的,其次题目可以将一个变量赋值为另一个 参考:```cpp #include <iostream> using namespace std; char p,q; int a[3]; int main() { while(scanf("%c:=%c;",&p,&q)==2) { a[p-'a']=q>='0'&&q<='9'?q-'0':a[q-'a']; } printf("%d %d %d",a[0],a[1],a[2]); return 0; } ```
by meifan666 @ 2024-08-02 22:26:24


```cpp #include <iostream> using namespace std; char p,q; int a[3]; int main() { while(scanf("%c:=%c;",&p,&q)==2) { a[p-'a']=q>='0'&&q<='9'?q-'0':a[q-'a']; } printf("%d %d %d",a[0],a[1],a[2]); return 0; } ``` @[meifan666](/user/1284088)
by meifan666 @ 2024-08-02 22:26:47


@[meifan666](/user/1284088) 嗯呢,感激不尽
by Nina__happy @ 2024-08-02 22:29:44


|