 # AUNX-Editorial

Contest

Author: Arnab Das
Editorialist: Mahir Asef Kabir

CAKEWALK

### PROBLEM:

There will be two integer value f (1<=f<=12) and s (1<=s<=6) , were f denotes the position of the fret and s denotes the string number (here, the strings are numbered 1 to 6 from top to bottom). We need to find the note of that particular fret for that particular guitar string.

### QUICK EXPLANATION:

We need to map the position of each fret with the name of that fret. Then for each s we will first get its position. Then from there we need to go f units further in a circular order. That means if we reach the end point we will go to starting index next.

### AUTHOR’S AND TESTER’S SOLUTIONS:

Author’s solution can be found here.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char notes;
int fret_board;
int pos = {0,5,12,8,3,10,5};

void preprocess(){

``````strcpy(notes,"C");
strcpy(notes,"C#");
strcpy(notes,"D");
strcpy(notes,"D#");
strcpy(notes,"E");
strcpy(notes,"F");
strcpy(notes,"F#");
strcpy(notes,"G");
strcpy(notes,"G#");
strcpy(notes,"A");
strcpy(notes,"A#");
strcpy(notes,"B");
int i,j,p;
for( i = 1 ; i <=6 ; i ++ ){
p = pos[i];
for(j = 0 ; j <= 12 ; j ++){

fret_board[j][i] = p;
p++;
if(p > 12 )p = 1;

}

}
``````

}

int main (){

``````int t,i,j,k;
int f,s;
preprocess();
scanf("%d",&t);
for( i = 1 ; i <= t ; i ++ ){
scanf("%d%d",&f,&s);
printf("Case %d: %s\n",i,notes[fret_board[f][s]]);
}

return 0;
``````

}