Wrong Answer
/in/foo.c: In function 'main': /in/foo.c:55:2: warning: 'gets' is deprecated [-Wdeprecated-declarations] gets(list[i]); ^~~~ In file included from /in/foo.c:1:0: /usr/include/stdio.h:640:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^~~~ /tmp/cc8cCej6.o: In function `main': foo.c:(.text.startup+0x20): warning: the `gets' function is dangerous and should not be used.
代码
#include<stdio.h>
#include<string.h>
char list[10][10];
int fun(int k,int n)
{
int i;
if(k==9)
{
for(i=n;i<10;i++)
{
if(list[9][i]!='.')
break;
}
if(i==10)
return 1;
else
return 0;
}
else
{
while(n>=0)
{
if(list[k][n-1]=='.')
n=n-1;
else
break;
}
if(n==-1)
n=0;
for(i=n;i<10&&list[k][i]=='.';i++)
{
if(i>=1&&list[k+1][i-1]=='.')
{
if(fun(k+1,i-1)==1)
return 1;
}
if(list[k+1][i]=='.')
{
if(fun(k+1,i)==1)
return 1;
}
if(i<=8&&list[k+1][i+1]=='.')
{
if(fun(k+1,i+1)==1)
return 1;
}
}
return 0;
}
}
int main()
{
int i;
for(i=0;i<10;i++)
gets(list[i]);
if(fun(0,0)==1)
printf("Yes\n");
else
printf("No\n");
return 0;
}
信息
- 递交者
- 类型
- 递交
- 题目
- P1001 hitwh 2019 新生赛 B lxdlam 和他的迷宫
- 语言
- C
- 递交时间
- 2020-12-24 15:23:38
- 评测时间
- 2020-12-24 15:23:38
- 评测机
- 分数
- 80
- 总耗时
- 4ms
- 峰值内存
- 220.0 KiB