제출 #339174

#제출 시각아이디문제언어결과실행 시간메모리
339174ammar2000고장난 휴대전화기 (COCI14_mobitel)C++17
50 / 50
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; string l[]={"2","22","222","3","33","333","4","44","444","5","55","555","6","66","666","7","77","777","7777","8","88","888","9","99","999","9999"}; map <int,int> mp; string s; int main() { int a; for (int i=0;i<9;i++) { cin>>a; mp[a]=i+1; } cin>>s; for (int i=0;i<s.length();i++) {if (i&&l[s[i]-'a'][0]==l[s[i-1]-'a'][0]) cout <<"#"; //cout <<s[i]-'a'<<" " ; for (int g=0;g<l[s[i]-'a'].length();g++) cout <<mp[l[s[i]-'a'][g]-'0'];} return 0; }

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

mobitel.cpp: In function 'int main()':
mobitel.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for (int i=0;i<s.length();i++)
      |                  ~^~~~~~~~~~~
mobitel.cpp:20:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int g=0;g<l[s[i]-'a'].length();g++)
      |                  ~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...