제출 #1120635

#제출 시각아이디문제언어결과실행 시간메모리
1120635vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
35.83 / 100
1092 ms508 KiB
// Telebe of adicto yani AzeTurk810 /* Author: AzeTurk810 Licance: open source(only authors name must be in code) Begin Time:11/20/2024 20:48 Problem link: https://codeforces.com/problemset/problem/1543/D1 */ #include <iostream> #include <vector> #include <algorithm> #include <set> #include <cmath> const int MAXN = 50005; bool check(std::string s) { std::string sc = s; reverse(sc.begin(),sc.end()); return sc == s; } signed main() { std::ios_base::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0); int l,r,ans = 0; scanf("%d%d", &l, &r); std:: string s,sc,scc; for(int i=l;i<=r;i++) { bool ok = true; s = std::to_string(i); sc=""; for(int i = 0;i<s.size()-1;i++) { sc = ""; scc = ""; if(s.size() > i ) {scc = scc + s[i] ;scc = scc + s[i +1] ;scc = scc + s[ i + 2];} sc = sc + s[i] ; sc = sc + s[ i+ 1]; if(check(sc) || check(scc)){ ok = false; //cout<<sc<< ' '<<scc<< ' '<<s<<endl; break; } } if(ok) ans++; }printf("%d\n", ans); }

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

numbers.cpp: In function 'int main()':
numbers.cpp:34:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for(int i = 0;i<s.size()-1;i++)
      |                       ~^~~~~~~~~~~
numbers.cpp:38:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |             if(s.size() > i )
      |                ~~~~~~~~~^~~
numbers.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |     scanf("%d%d", &l, &r);
      |     ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...