#7037: Why RE?


yatsen (愛情少校)

學校 : 高雄市立高雄高級中學
編號 : 3260
來源 : [218.166.67.24]
最後登入時間 :
2024-05-06 00:29:48
a520. 12416 - Excessive Space Remover -- UVa12416 | From: [163.32.78.61] | 發表日期 : 2012-09-25 15:56

#include <stdio.h>
#include <string.h>
char s[100000000];
int main()
{
    int i,flag,count,maxspace;
    while(gets(s))
    {
        if(s[0]==' ')
            flag=count=1;
        else
            flag=count=0;

        for(maxspace=0,i=1; s[i]; i++)
        {
            if(s[i]==' ')
            {
                if(flag) count++;
                else flag=count=1;
            }
            else
            {
                if(count>maxspace) maxspace=count;
                flag=count=0;
            }
        }
        for(count=0; maxspace>1; count++)
            maxspace=(maxspace+1)/2;
        printf("%d\n",count);
    }
    return 0;
}
 
#7041: Re:Why RE?


passerr (20130326 0340 48)

學校 : 不指定學校
編號 : 8516
來源 : [125.231.19.112]
最後登入時間 :
2017-05-06 03:26:00
a520. 12416 - Excessive Space Remover -- UVa12416 | From: [125.224.234.45] | 發表日期 : 2012-09-26 09:54

你把

char s[100000000];

改成

char s[2500];

看看

(或許還能更小?)

 
#8217: Re:Why RE?


cuh127 (futurhack~~~~~興國猩國也(絕對沒有在污辱女性))

學校 : 臺南市私立興國高級中學
編號 : 28132
來源 : [203.68.26.150]
最後登入時間 :
2014-04-02 16:51:03
a520. 12416 - Excessive Space Remover -- UVa12416 | From: [118.233.170.236] | 發表日期 : 2013-09-21 22:59

你把

char s[100000000];

改成

char s[2500];

看看

(或許還能更小?)

爲什麼題目要寫出輸入小於1MB嚇人??

 
ZeroJudge Forum