版本比较
题解 P9754 [CSP-S 2023] 结构体
正文
增加 4 行删除 4 行
71 行未改动72737475767778798082 行未改动16316416516616716816917017117217317417517617717817918018118218323 行未改动71 行未改动ans+=st[now].bg[st[now].anti[sub]];//答案加上begin数组的值now=st[now].mem[st[now].anti[sub]];//对现在指向的元素类型进行更新sub.clear();//别忘了清空字符串}else sub+=s[i];}cout<<ans<<endl;```82 行未改动st[0].nam[i]=na;st[0].anti[na]=i;st[0].tp=upto(st[0].tp,st[p[typ]].rm);st[0].bg[i]=st[0].tp;st[0].tp+=st[p[typ]].tp;st[0].ed[i]=st[0].tp;st[0].tp=upto(st[0].tp,st[p[typ]].rm);cout<<st[0].bg[i]<<endl;}if(opt==3){cin>>s;sub.clear();now=ans=0;s+='.';for(reg i=0;i<s.size();i++){if(s[i]=='.'){ans+=st[now].bg[st[now].anti[sub]];now=st[now].mem[st[now].anti[sub]];sub.clear();}else sub+=s[i];}cout<<ans<<endl;}if(opt==4){23 行未改动71 行未改动72737475767778798082 行未改动16316416516616716816917017117217317417517617717817918018118218323 行未改动71 行未改动ans+=st[now].bg[st[now].anti[sub]];//答案加上begin数组的值now=st[now].mem[st[now].anti[sub]];//对现在指向的元素类型进行更新sub.clear();//别忘了清空字符串}else sub+=s[i];}cout<<ans<<endl;```82 行未改动st[0].nam[i]=na;st[0].anti[na]=i;st[0].tp=upto(st[0].tp,st[p[typ]].rm);st[0].bg[i]=st[0].tp;st[0].tp+=st[p[typ]].tp;st[0].ed[i]=st[0].tp;st[0].tp=upto(st[0].tp,st[p[typ]].rm);cout<<st[0].bg[i]<<endl;}if(opt==3){cin>>s;sub.clear();now=ans=0;s+='.';for(reg i=0;i<s.size();i++){if(s[i]=='.'){ans+=st[now].bg[st[now].anti[sub]];now=st[now].mem[st[now].anti[sub]];sub.clear();}else sub+=s[i];}cout<<ans<<endl;}if(opt==4){23 行未改动