#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}
};
printf("通話時間を入力せよ(分 秒)- - - - >"); scanf("%d %d", &min
, &sec
);
sec += (min - costTable[kubun - 1][0] ) * 60;
price =costTable[kubun - 1][1];
slotNum = slotCount(sec, costTable[kubun - 1][2]);
price += slotNum * costTable[kubun - 1][3];
printf("あなたの通話料金は¥%dです\n", price
);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNkZWZpbmUgc2xvdENvdW50KGEsYikgKGEpLyhiKSsoKGEpJShiKSE9MCkKaW50IG1haW4oKQp7CiAgICBpbnQgbWluLCBzZWMsIGt1YnVuLCBwcmljZSA9IDAsIHNsb3ROdW07CiAgICBpbnQgY29zdFRhYmxlWzNdWzRdID0KICAgIHsKICAgICAgICB7MSwgMzAwLCA2LCAxNX0sIHsxLCAyNDAsIDYsIDEyfSwgezEsIDE4MCwgNiwgOX0KICAgIH07CgogICAgcHJpbnRmKCLpgJroqbHmmYLplpPjgpLlhaXlipvjgZvjgogo5YiGICAg56eSKS0gLSAtIC0gPiIpOwogICAgc2NhbmYoIiVkICVkIiwgJm1pbiwgJnNlYyk7CiAgICBwcmludGYoIuWMuuWIhuOCkuWFpeWKm+OBm+OCiC0gLSAtIC0gPiIgKTsKICAgIHNjYW5mKCIlZCIsICZrdWJ1bik7CgogICAgc2VjICs9IChtaW4gLSBjb3N0VGFibGVba3VidW4gLSAxXVswXSApICogNjA7CgogICAgcHJpY2UgPWNvc3RUYWJsZVtrdWJ1biAtIDFdWzFdOwoKICAgIHNsb3ROdW0gPSBzbG90Q291bnQoc2VjLCBjb3N0VGFibGVba3VidW4gLSAxXVsyXSk7CiAgICBwcmljZSArPSBzbG90TnVtICogY29zdFRhYmxlW2t1YnVuIC0gMV1bM107CgogICAgcHJpbnRmKCLjgYLjgarjgZ/jga7pgJroqbHmlpnph5Hjga/CpSVk44Gn44GZXG4iLCBwcmljZSk7CgogICAgcmV0dXJuIDA7Cn0K