Submission #937583

# Submission time Handle Problem Language Result Execution time Memory
937583 2024-03-04T09:15:32 Z sleepntsheep Mobitel (COCI14_mobitel) C
50 / 50
1 ms 604 KB
#include<stdio.h>

int map[10];
char a[]="$$adgjmptw$$$\0",s[104];
int key(char c){
    for(int j=9;;--j)if(a[j]<=c)return j;
}

int main(){
    for(int j,i=1;i<=9;++i)scanf("%d",&j),map[j]=i;
    scanf("%s",s+1);
    for(int ls=-1,i=1;s[i];++i){
        int k=key(s[i]);
        if(ls==k)putchar('#');
        for(int j=s[i]-a[k]+1;j--;)putchar('0'+map[k]);
        ls=k;
    }

}

Compilation message

mobitel.c: In function 'main':
mobitel.c:10:28: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     for(int j,i=1;i<=9;++i)scanf("%d",&j),map[j]=i;
      |                            ^~~~~~~~~~~~~~
mobitel.c:11:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%s",s+1);
      |     ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct