提交记录 #181
提交时间:2024-11-12 16:32:10
语言:c
状态:Unaccepted
编译情况:编译成功
code.c: In function ‘main’:
code.c:13:15: warning: array subscript has type ‘char’ [-Wchar-subscripts]
13 | if (!s[c]){
| ^
code.c:15:14: warning: array subscript has type ‘char’ [-Wchar-subscripts]
15 | s[c]=1;
| ^
code.c:19:14: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
19 | printf("%s\n",r);
| ~^ ~
| | |
| | int
| char *
| %d
code.c:7:10: warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
7 | char result[maxlengh+1];
| ^~~~~~
固定测试点#1:
固定测试点#2:
固定测试点#3:
固定测试点#4:
固定测试点#5:
附加测试点暂不可用
33【字符】删除重复字符
#include<stdio.h>
#include<string.h>
#define maxlengh 100
int main(){
char input[maxlengh+1];
char result[maxlengh+1];
int s[256]={0};
int r=0;
scanf("%s",input);
for (int i=0;i<strlen(input);i++){
char c=input[i];
if (!s[c]){
result[r++]=c;
s[c]=1;
}
}
result[r]='\0';
printf("%s\n",r);
return 0;
}