답안 #856346

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
856346 2023-10-03T07:56:41 Z vjudge1 Password (RMI18_password) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
string s,a,b,ans;
int x=1,ss;
int main()
{
	ios::sync_with_stdio(false);
	//freopen("pass.in","r",stdin);
	//freopen("pass.out","w",stdout);
	cin>>s;
	ss=s.size();
	s=" "+s;
	a=s[1];
	b=s[ss];
	s.erase(ss,1);
	s.erase(1,1);
	ss-=2;
	for(int c=1;c<=ss;c++)
	{
		a+=s[c];
		b=s[ss]+b;
		if(a==b&&s.find(a)!=-1)
		{
			ans=a;
		}
		ss-=2;
		if(ss<3) break;
	}
	if(ans=="") cout<<"qwerty";
	else cout<<ans;
	return 0;
}//666

Compilation message

password.cpp: In function 'int main()':
password.cpp:22:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |   if(a==b&&s.find(a)!=-1)
      |            ~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccQmu94M.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccs7NDuN.o:password.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccQmu94M.o: in function `main':
grader.cpp:(.text.startup+0x66): undefined reference to `guess[abi:cxx11](int, int)'
collect2: error: ld returned 1 exit status