| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 125119 | 范恒恺 | 单词的长度 | C++ | Compile Error | 0 MS | 0 KB | 251 | 2025-07-13 14:54:36 |
#include<iostream> #include<cstring> using namespace std; int main() { char n; cin>>n; char max='0'; int len=strlen(n); int i=0; if(n[0]=='-') { i=1; } for(i; i<len; i++) { if(n[i]>max) { max=n[i]; } } cout<<max; }
Main.cc: In function 'int main()':
Main.cc:8:18: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
int len=strlen(n);
^
In file included from /usr/include/c++/5/cstring:42:0,
from Main.cc:2:
/usr/include/string.h:394:15: note: initializing argument 1 of 'size_t strlen(const char*)'
extern size_t strlen (const char *__s)
^
Main.cc:10:8: error: invalid types 'char[int]' for array subscript
if(n[0]=='-') {
^
Main.cc:13:7: warning: statement has no effect [-Wunused-value]
for(i; imax) {
^
Main.cc:15:11: error: invalid types 'char[int]' for array subscript
max=n[i];
^