@[P指向NULL](/space/show?uid=58399) 怎么搞??
by ⚡GG⚡ @ 2019-03-29 16:22:20
@[P指向NULL](/space/show?uid=58399) [挂编译……](https://www.luogu.org/recordnew/show/17696073)
by ⚡GG⚡ @ 2019-03-29 16:24:06
@[垃圾一个](/space/show?uid=85933)
```
#include<bits/stdc++.h>
#define int __int128
using namespace std;
vector<char> rule[303];
string a;
int k;
bool tag[505];
char ch,ch2;
int read()
{
int x=0,f=0;
char ch=0;
while(!isdigit(ch))f|=(ch=='-'),ch=getchar();
while(isdigit(ch))(x*=10)+=(ch^48),ch=getchar();
return f?-x:x;
}
void print(int x)
{
if(x<0)putchar('-'),x=-x;
if(x>=10)print(x/10);
putchar(x%10+48);
}
signed main(){
cin>>a;
k=read();
for(int i=0;i<k;i++)
cin>>ch>>ch2,rule[(int)ch].push_back(ch2);
queue<char>qu;
int ans=1,sum;
for(int i=0;i<a.length();i++){
sum=1;
memset(tag,0,sizeof(tag));
qu.push(a[i]);
tag[(int)a[i]]=1;
while(!qu.empty()){
ch=qu.front(),qu.pop();
for(int j=0;j<rule[(int)ch].size();j++){
if(!tag[(int)rule[(int)ch][j]]){
tag[(int)rule[(int)ch][j]]=1;
qu.push((int)rule[(int)ch][j]);
sum=sum+1;
}
}
}
ans*=sum;
}
print(ans);
return 0;
}
```
__int128需要自己提供读入和输出,而且main 必须返回signed 或者 int
by 狸狸养的敏敏 @ 2019-03-29 16:40:31
@[P指向NULL](/space/show?uid=58399) 其实重定义运算符也行……
by ⚡GG⚡ @ 2019-03-29 16:41:50
@[垃圾一个](/space/show?uid=85933) 嗯,其实那就是自己提供了读入和输出啊
```
绑定ostream <<就好了QWQ
```
by 狸狸养的敏敏 @ 2019-03-29 16:43:23
@[P指向NULL](/space/show?uid=58399) 反正我不会就对了
by ⚡GG⚡ @ 2019-03-29 16:44:45
%%%@[P指向NULL](/space/show?uid=58399)
您写了很好的代码
学到了qwq;
by 羽儇 @ 2019-05-09 15:51:10