提交记录 #538
提交时间:2025-01-07 20:36:36
语言:c
状态:Unaccepted
编译情况:编译成功
code.c: In function ‘main’:
code.c:54:9: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
54 | gets(str);
| ^~~~
| fgets
/usr/bin/ld: /tmp/cc8y4yM9.o: in function `main':
code.c:(.text.startup+0x66): warning: the `gets' function is dangerous and should not be used.
固定测试点#1:
固定测试点#2:
附加测试点暂不可用
36【应用】安全的密码
#include <stdio.h>
#include <string.h>
int testlen(char *str)
{
int len=strlen(str);
if(len<6)
{
printf("Not Safe\n");
return 0;
}
else return 1;
}
int test(char *str)
{
int len=strlen(str);
int flag=0;
for(int i=0;i<len;i++)
{
if(str[i]>='0'&&str[i]<='9')
{
flag++;
break;
}
}
for(int i=0;i<len;i++)
{
if(str[i]>='a'&&str[i]<='z')
{
flag++;
break;
}
}
for(int i=0;i<len;i++)
{
if(str[i]>='A'&&str[i]<='Z')
{
flag++;
break;
}
}
return flag;
}
int main()
{
int n,cnt=1;
scanf("%d",&n);
while(cnt<=n)
{
char str[100];
gets(str);
if(testlen(str)==0)
{
break;
}
int flag=test(str);
switch (flag)
{
case 1:printf("Not Safe\n");break;
case 2:printf("Medium Safe\n");break;
case 3:printf("Safe\n");break;
}
cnt++;
}
return 0;
}