@[Voltaire_Zhang](/user/1267789)
我觉得你是第一个for循环那里出错。我知道你是为了读入换行,但是实际测评中可能会出错(我之前也错过)
建议改成``getline(cin,s);``解决
by smll_wlm @ 2024-02-23 08:33:10
我的也是,全WA,C++就过了,代码如下:
```c
#include <stdio.h>
#include <stdlib.h>
int comp(const void* a,const void* b){
return *(int*)a - *(int*)b;
}
int main(){
int nums[3];
char A,B,C;
scanf("%d %d %d",&nums[0],&nums[1],&nums[2]);
getchar();
scanf("%c%c%c",&A,&B,&C);
qsort(nums,3,sizeof(int),comp);
printf("%d %d %d",nums[(int)A-'A'],nums[(int)B-'A'],nums[(int)C-'A']);
return 0;
}
```
by yinda_peng @ 2024-02-27 18:08:19
@[Voltaire_Zhang](/user/1267789)
我觉得你第一个for循环结束后加两个getchar()应该就能过,而你这只有一个getchar()。
这里的回车和换行应该各算一个字符,去了解一下回车与换行的区别,就能理解了。
by pangxiang @ 2024-03-01 15:08:21