提交记录 #201
提交时间:2024-11-12 19:49:48
语言:c
状态:Unaccepted
编译情况:编译成功
code.c: In function ‘main’:
code.c:41:5: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
41 | gets(str);
| ^~~~
| fgets
/usr/bin/ld: /tmp/ccgQzC4m.o: in function `main':
code.c:(.text.startup+0x10): warning: the `gets' function is dangerous and should not be used.
固定测试点#1:
固定测试点#2:
固定测试点#3:
固定测试点#4:
额外测试点#10:
37【字符】自编车号
#include <stdio.h>
#include <string.h>
int test_last(char str[10])
{
int flag=0;
if(str[4]<'0'||str[4]>'9')
{
flag=1; //不是数字
}
return flag;
}
int test_letter(char str[10])
{
int flag1=0,flag2=0;
for(int i=0;i<5;i++)
{
if(str[i]>=65||str[i]<=90)
{
flag2++; //大写英文个数
}
if(str[i]=='I'||str[i]=='O')
{
flag1=1;//存在I O
}
}
if(flag2>=2&&flag1!=1)
{
return 1;//可以
}
else return 0;//不可以
}
int main()
{
char str[10];
gets(str);
if(strlen(str)<5)
{
printf("no\n");
return 0;
}
if(test_last(str)==1)
{
printf("no.\n");
return 0;
}
if(test_letter(str)==1)
{
printf("ok.\n");
return 0;
}
else if(test_letter(str)==0)
{
printf("no.\n");
return 0;
}
}