资源限制 内存限制:512.0MB C/C++时间限制:1.0s Java时间限制:3.0s Python时间限制:5.0s 求出5个字符串中最长的字符串。每个字符串长度在100以内,且全为小写字母。 样例输入 one two three four five 样例输出 three
提交代码:
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <math.h>
using namespace std;
char a[5][105];
int main()
{
int max=0,ans=0;
for(int i=0;i<5;i++)
{
scanf("%s",a[i]);
if(max<strlen(a[i]))
{
max=strlen(a[i]);
ans=i;
}
}
cout<<a[ans]<<endl;
return 0;
}