제출 #713567

#제출 시각아이디문제언어결과실행 시간메모리
713567ALTAKEXEMobitel (COCI14_mobitel)C++14
50 / 50
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; int main() { //freopen("input.txt","r",stdin); char s[101]; int a[11]; string ss; string v[] = {"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"}; for (int i = 0; i < 9; ++i) { int x; scanf("%d",&x); a[x] = i + 1; } scanf("%s", s); int len = strlen(s); int last = -1; for (int i = 0; i < len; ++i) { if (last == v[s[i] - 'a'][0] - '0') ss += "#"; last = v[s[i] - 'a'][0] - '0'; ss += v[s[i] - 'a']; } for (int i = 0; i < (int) ss.size(); ++i) { if (ss[i] == '#') printf("#"); else printf("%c", '0' + a[ss[i] - '0']); } return 0; }

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

mobitel.cpp: In function 'int main()':
mobitel.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d",&x);
      |         ~~~~~^~~~~~~~~
mobitel.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%s", s); int len = strlen(s);
      |     ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...