Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
78055 sh25_shenpy 最长单词 C++ 解答错误 0 MS 240 KB 554 2025-12-26 15:19:24

Tests(0/3):


#include<bits/stdc++.h> #include<cstring> using namespace std; int main(){ int n=0,max=0; string s; cin>>s; for(int i=0;i<s.size()-1;++i){ if(s[i]!='\n') ++n; else{ if(n>max) max=n; n=0; } } n=0; for(int j=0;j<s.size()-1;++j){ if(s[j]!='\n') ++n; else{ if(n==max){ for(int o=j-n;o<j;++o){ cout<<s[o]; } break; } } } return 0; }


测评信息: