当前位置: 58彩票app下载 > 操作系统 > 正文

杭电HDU练习题_hdu_1.2.5

时间:2020-01-05 09:25来源:操作系统
#include stdio.h#include math.hint main(void){ int line, num, band, sum, i; char ch_l, ch_r; while(scanf("%d", line) != EOF) { if(line == 0) break; sum = 0; while(line--) { i = 0; scanf("%d%c%d%c", num, ch_l, band, ch_r); while(num) { sum +
#include <stdio.h>
#include <math.h>

int main(void)
{
    int line, num, band, sum, i;
    char ch_l, ch_r;

    while(scanf("%d", &line) != EOF)
    {
        if(line == 0) break;

        sum = 0;
        while(line--)
        {
            i = 0;
            scanf("%d%c%d%c", &num, &ch_l, &band, &ch_r);

            while(num)
            {
                sum += num % 10 * pow(band,i++);
                num /= 10;
            }

        }
        printf("%dn", sum);
    }

    return 0;
}

编辑:操作系统 本文来源:杭电HDU练习题_hdu_1.2.5

关键词: