70分求助QAQ在线等 c语言
查看原帖
70分求助QAQ在线等 c语言
945418
unbelievable_cheese楼主2023/2/19 11:25

#代码如下

#include <stdio.h>
#include <string.h>

struct  zf {
	char a;
	int b;
} st1[26];

int main() {
	char st2[1100];
	int i, j, len,n=0;
	gets(st2);
	len = strlen(st2);
//	puts(st2);
	for (i = 0; i < 26; i++) 
    {
		st1[i].a = ' ';
		st1[i].b = 0;
	}
	for (i = 0, j = 0; i < len; i++) 
    {
		for (int k = 0; k <= n; k++) 
        {
			if (st2[i] == st1[k].a) 
            {
				st1[k].b ++;
				break;
			} else 
            {
				if (k == j) 
                {
					st1[j].a = st2[i];
					st1[j].b = 1;
					j++;
				} else
					continue;
			}
		}n=j;
	}
for (i = 0; i < j; i++) {
	if (st1[i].b == 1)
   {
	printf("%c", st1[i].a );
        break;
		} 
   else if(st1[i].b>=2) {
		if (i == (j - 1)) {
			printf("no");
			} else
			continue;
		}
	}
	return 0;
}

前三个就过不去,dev上的"no",显示正常.

2023/2/19 11:25
加载中...