1. 业奇农业网 > 资讯 >

c语言计算价格

int?main()

c语言计算价格

{

int?price[100];

intn,?m,?total?=?0,?i;

scanf("%d?%d",?&n,?&m);

i?=?0;

while?(i?<?n)?{

int?no,?p;

scanf("%d?%d",?&no,?&p);

price[no-1]?=?p;

i++;

}

i?=?0;

while?(i?<?m)?{

int?no,?cnt;

scanf("%d?%d",?&no,?&cnt);

total?+=?cnt?*?price[no-1];

i++;

}

printf("%dn",?total);

return?0;

}

本文由用户上传,如有侵权请联系删除!转转请注明出处:https://nongye.s666.cn/news/1_657469425.html