本站遷移

因為我最近租用了網路空間以及網域,
故本站已遷移至新網站~
這邊的資訊已經正在進行搬移的工作~
希望各位可以到新網站去逛XD

New Website:
http://knightzone.org/

搜尋此網誌

2011年1月18日 星期二

[Zerojudge]a011: 幼稚園的算數遊戲

利用非字母與字母相間的關係,
找出總共有幾個Word。

[C++](2ms, 754KB)
#include<iostream>
#include<cctype>
using namespace std;
int main()
{
string s;
while( getline( cin, s ) )
{
int num = 0;
bool word = 0;
for( int i = 0 ; i < s.length(); i++ )
{
if( isalpha( s[i] ) )
{
if( !word )
{
word = 1;
num++;
}
}
else
word = 0;
}
cout << num << endl;
}
return 0;
}

0 意見:

張貼留言