24h購物| | PChome| 登入
2009-04-04 12:30:59| 人氣716| 回應0 | 上一篇 | 下一篇

幼稚園的算數遊戲

推薦 0 收藏 0 轉貼0 訂閱站台

/************************************************************/

#include<stdio.h>     
#include<stdlib.h>
#include<string.h>
main()
{
  int temp=0,a,b,time=0;
  char c[999999];
  while(gets(c))   
  {temp=0;time=0; /*兩者皆要歸0*/
   for(a=0;a<strlen(c);a++)
    {
      if((c[a]>=65&&c[a]<=90)||(c[a]>=97&&c[a]<=122))
       temp=1;
      else
      {
       time=temp+time;
        temp=0;               /*else也要刮弧 不然沒有歸0到*/
      }
    }
   if(temp!=0) /*直接英文結尾 temp則為1 但是沒加到*/
    {
     time++;
    }
     printf("%d\n",time);
  }
 return 0;    
}

台長: 來源不明

您可能對以下文章有興趣

人氣(716) | 回應(0)| 推薦 (0)| 收藏 (0)| 轉寄
全站分類: 數位資訊(科技、網路、通訊、家電) | 個人分類: ZeroJudge 基礎+原創題庫 |
此分類下一篇:Hashmat的戰役
此分類上一篇:因數分解

是 (若未登入"個人新聞台帳號"則看不到回覆唷!)
* 請輸入識別碼:
請輸入圖片中算式的結果(可能為0) 
(有*為必填)
TOP
詳全文