之前感觉有用过getline,但是最近做题又发现好像不可以,所以字符串、字符之类的到底有哪些输入是可以的,哪些是要特别小心的
P.S.
这两个输入方式有什么不一样吗
对于:
R 2 4
S 4 1
R 3 2
R 2 0
正确:
char c;
for(int i = 1; i <= k; i++){
c = getchar();
while(c != 'R' && c != 'S') c = getchar();
scanf("%lld%lld", &x, &y);
if(c == 'R'){
hang[x] = hang[x] * y % mod;
}
else{
lie[x] = lie[x] * y % mod;
}
}
错误:
string s;
for(int i=1;i<=k;i++){
cin>>s;
cin>>x>>y;
if(s[0]=='R')hang[x]*=y;
if(s[0]=='S')lie[x]*=y;
}