记录详情

Wrong Answer

/in/foo.cc: In function 'int main()':
/in/foo.cc:10:2: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(st);
  ^~~~
In file included from /usr/include/c++/6/cstdio:42:0,
                 from /usr/include/c++/6/ext/string_conversions.h:43,
                 from /usr/include/c++/6/bits/basic_string.h:5417,
                 from /usr/include/c++/6/string:52,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/in/foo.cc:10:9: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(st);
         ^
In file included from /usr/include/c++/6/cstdio:42:0,
                 from /usr/include/c++/6/ext/string_conversions.h:43,
                 from /usr/include/c++/6/bits/basic_string.h:5417,
                 from /usr/include/c++/6/string:52,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/in/foo.cc:11:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<=strlen(st);++i)
              ~^~~~~~~~~~~~
/in/foo.cc:14:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<=strlen(st)-1;++i)
              ~^~~~~~~~~~~~~~
/tmp/ccOlm0tP.o: In function `main':
foo.cc:(.text.startup+0x1f): warning: the `gets' function is dangerous and should not be used.
# 状态 耗时 内存占用
#1 Wrong Answer 2ms 340.0 KiB
#2 Wrong Answer 1ms 340.0 KiB

代码

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

int main()
{
	char st[10];
	gets(st);
	for(int i=1;i<=strlen(st);++i)
		if((int)st[i-1]>=48&&(int)st[i-1]<=57)
			st[i-1]='x';
	for(int i=1;i<=strlen(st)-1;++i)
		cout<<st[i-1];
	system("pause");
	return 0;
}

信息

递交者
类型
递交
题目
P1006 大炮的混乱程序
语言
C++
递交时间
2019-07-09 10:30:24
评测时间
2019-07-09 10:30:24
评测机
分数
0
总耗时
3ms
峰值内存
340.0 KiB