PersonalCorpus 版 (精华区)

Your C++ program has solved Ok the problem 10300 (Ecological Premium)
in 0.000 seconds with low memory spent.

int readnum(int &i)
{
    char ch;
    i=0;

    do {
        scanf("%c",&ch);
    } while (!isdigit(ch));

    do {
        i*=10;
        i+=ch-48;
        scanf("%c",&ch);
        if (feof(stdin)) break;
    } while (isdigit(ch));
    return i;
}


void main()
{
#ifndef ONLINE_JUDGE
    freopen("c:\\0acm\\uva\\i10300","r",stdin);
    freopen("c:\\0acm\\uva\\o10300","w",stdout);
#endif

    int i,j,k,f,a,b,c,n;

    readnum(n);
    while (n--) {
        readnum(f); k=0;
        while (f--) {
            readnum(a);
            readnum(b);
            readnum(c);
            k+=a*c;
        }
        printf("%d\n",k);
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.870毫秒