#30001: 問個,這是哪個測資過不了阿?


alviee19 (alviee19)

學校 : 不指定學校
編號 : 190227
來源 : [114.43.187.169]
最後登入時間 :
2022-10-20 19:39:19

using namespace std;

int main() { 

#include<bits/stdc++.h>

#define endl '\n'

ios::sync_with_stdio(false);

  cin.tie(0);

  cout.tie(0);

  char s[1000];

  int count;

  while(cin.getline(s,1000)){

    count = 1;

    for(int i = 0; i < strlen(s); i++){

      if(s[i] == ' ' && isalpha(s[i+1])){

        count++;

      }

    }

    cout << count << endl;

  }

    return 0;

}

#30005: Re:問個,這是哪個測資過不了阿?


cges30901 (cges30901)

學校 : 不指定學校
編號 : 30877
來源 : [39.12.66.21]
最後登入時間 :
2025-04-20 17:19:22

      if(s[i] == ' ' && isalpha(s[i+1])){


有可能兩個字之間只有特殊符號,而不是空格