#include <stdio.h>
#define slotCount(a,b) (a)/(b)+((a)%(b)!=0)
int main()
{
    int min, sec, kubun, price = 0, slotNum;
    int costTable[3][4] =
    {
        {1, 300, 6, 15}, {1, 240, 6, 12}, {1, 180, 6, 9}
    }, *p = costTable[0];

    printf("通話時間を入力せよ(分   秒)- - - - >");
    scanf("%d %d", &min, &sec);
    printf("区分を入力せよ- - - - >" );
    scanf("%d", &kubun);
    p += (sizeof(costTable[0]) / sizeof(int)) * (kubun - 1);
    if (min >= p[0])
        sec += (min - p[0] ) * 60;
    else
        sec = 0;
    slotNum = slotCount(sec, p[2]);
    price = p[1] + slotNum * p[3];
    printf("あなたの通話料金は¥%dです\n", price);

    return 0;
}
