#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
); 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;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNkZWZpbmUgc2xvdENvdW50KGEsYikgKGEpLyhiKSsoKGEpJShiKSE9MCkKaW50IG1haW4oKQp7CiAgICBpbnQgbWluLCBzZWMsIGt1YnVuLCBwcmljZSA9IDAsIHNsb3ROdW07CiAgICBpbnQgY29zdFRhYmxlWzNdWzRdID0KICAgIHsKICAgICAgICB7MSwgMzAwLCA2LCAxNX0sIHsxLCAyNDAsIDYsIDEyfSwgezEsIDE4MCwgNiwgOX0KICAgIH0sICpwID0gY29zdFRhYmxlWzBdOwoKICAgIHByaW50Zigi6YCa6Kmx5pmC6ZaT44KS5YWl5Yqb44Gb44KIKOWIhiAgIOenkiktIC0gLSAtID4iKTsKICAgIHNjYW5mKCIlZCAlZCIsICZtaW4sICZzZWMpOwogICAgcHJpbnRmKCLljLrliIbjgpLlhaXlipvjgZvjgogtIC0gLSAtID4iICk7CiAgICBzY2FuZigiJWQiLCAma3VidW4pOwogICAgcCArPSAoc2l6ZW9mKGNvc3RUYWJsZVswXSkgLyBzaXplb2YoaW50KSkgKiAoa3VidW4gLSAxKTsKICAgIGlmIChtaW4gPj0gcFswXSkKICAgICAgICBzZWMgKz0gKG1pbiAtIHBbMF0gKSAqIDYwOwogICAgZWxzZQogICAgICAgIHNlYyA9IDA7CiAgICBzbG90TnVtID0gc2xvdENvdW50KHNlYywgcFsyXSk7CiAgICBwcmljZSA9IHBbMV0gKyBzbG90TnVtICogcFszXTsKICAgIHByaW50Zigi44GC44Gq44Gf44Gu6YCa6Kmx5paZ6YeR44GvwqUlZOOBp+OBmVxuIiwgcHJpY2UpOwoKICAgIHJldHVybiAwOwp9Cg==