| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 253 人关注过本帖
标题:帮忙看看,总是WA
只看楼主 加入收藏
枫叶无痕
Rank: 2
等 级:论坛游民
帖 子:80
专家分:30
注 册:2011-2-10
结帖率:73.91%
收藏
 问题点数:0 回复次数:0 
帮忙看看,总是WA
#include<stdio.h>
#include<string.h>
main()
{
    char str[101][101];
    int n,i,j,k,t,num[101][101]={0},f[101],max;
    while(scanf("%d",&n)!=EOF)
    {
        printf("\n");
        for(i=1;i<=n;i++)
        {
            printf("\n");
        }
        k=1;
        while(gets(str[k])!=NULL)
        {
            if(str[k][0]=='0')
            break;
            f[k]=strlen(str[k]);
            for(i=1;i<=f[k];i++)
            {
                num[k][i]=(int)(str[k][f[k]-i])-48;
            }
            k++;
        }
        k=k-1;
        max=f[1];
        for(i=1;i<=k;i++)
        {
            if(f[i]>max)
            max=f[i];
        }
        t=0;
        for(i=1;i<=max;i++)
        {
            for(j=1;j<=k;j++)
            {
                t=t+num[j][i];
            }
            f[i]=t%10;
            t=t/10;
        }
        if(t!=0)
        {
            f[max+1]=t;
            max=max+1;
        }
        for(i=1;i<=max;i++)
        {
            printf("%d",f[max-i+1]);
        }
        printf("\n");
    }
}

大家帮忙看看,这是这道题
Integer Inquiry

Time Limit:1000MS  Memory Limit:65536K
Total Submit:756 Accepted:206

Description

One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers.
``This supercomputer is great,'' remarked Chip. ``I only wish Timothy were here to see these results.'' (Chip moved to a new apartment, once one became available on the third floor of the Lemon Sky apartments on Third Street.)




Input

The input will consist of at most 100 lines of text, each of which contains a single VeryLongInteger. Each VeryLongInteger will be 100 or fewer characters in length, and will only contain digits (no VeryLongInteger will be negative).

The final input line will contain a single zero on a line by itself.


Output

Your program should output the sum of the VeryLongIntegers given in the input.

This problem contains multiple test cases!

The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.

The output format consists of N output blocks. There is a blank line between output blocks.

Sample Input


1


123456789012345678901234567890
123456789012345678901234567890
123456789012345678901234567890
0

Sample Output


370370367037037036703703703670
Source

East Central North America 1996 zjo1292
搜索更多相关主题的帖子: max include 
2011-07-04 12:43
快速回复:帮忙看看,总是WA
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032778 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved