제출 #1010578

#제출 시각아이디문제언어결과실행 시간메모리
1010578tarpent원형 문자열 (IZhO13_rowords)C++14
0 / 100
2097 ms348 KiB
#include<bits/stdc++.h>
using namespace std;


string a,b;
int m,pr,od;
int main(){
	cin>>a>>b;
	m=-1;
	for(int i = 0; i<a.size(); i++){
		int j = pr;
		while(true){
			if(a[i]==b[j]){
				od++;
				pr=j;
				if(m==-1) m=j;
			}
			if(j==b.size()-1){
				j=0;
			}
			else j++;
			if(j==m-1){
				break;
			}
			
			
			
		}
	}
	cout<<od;
	
	
	
}

컴파일 시 표준 에러 (stderr) 메시지

rowords.cpp: In function 'int main()':
rowords.cpp:10:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for(int i = 0; i<a.size(); i++){
      |                 ~^~~~~~~~~
rowords.cpp:18:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |    if(j==b.size()-1){
      |       ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...