#499: 我改過寫法,不過換成WA了


trewsla (trewsla)


以下為code

#include <iostream>  
#include <cstring>  
using namespace std;  
int main()  
{  
 string a;     
 while (getline(cin,a))  
   {      
     int b=1;    
     for (int i=0;i<=(a.size()-1);i++)  
       {  
         if ((a[i]<122 && a[i]>97) || (a[i]>65 && a[i]<90))    
           {  
             if ((i!=0) && (a[i-1]>122 || a[i-1]<65 || (a[i-1]<97 && a[i-1]>90)))   
                 b=b+1;              
           }  
       }  
    cout << b <<endl;     
   }  
return 0;  
}

可以請教各位大大 我哪裡沒注意到嗎

或提供一組會使我的程式WA的測資給我

謝謝

#501: Re:我改過寫法,不過換成WA了


trewsla (trewsla)


以下為code

#include <iostream>   #include <cstring>   using namespace std;   int main()   {    string a;       while (getline(cin,a))      {            int b=1;          for (int i=0;i<=(a.size()-1);i++)          {            if ((a[i]<122 && a[i]>97) || (a[i]>65 && a[i]<90))                {                if ((i!=0) && (a[i-1]>122 || a[i-1]<65 || (a[i-1]<97 && a[i-1]>90)))                     b=b+1;                          }          }       cout << b <<endl;         }   return 0;   } 

可以請教各位大大 我哪裡沒注意到嗎

或提供一組會使我的程式WA的測資給我

謝謝

後來又稍為修改了一下 不過還是WA

與正確輸出不相符(line:1)
您的答案為: 10
正確答案為: 11

請各位大大幫一下忙吧 謝謝

code:

#include <iostream>   
using namespace std;  
int main()  
{  
 string a;     
 while (getline(cin,a))  
   {      
     int b=1;    
     for (int i=0;i<=(a.size()-1);i++)  
       {  
         if ((a[i]<122 && a[i]>97) || (a[i]>65 && a[i]<90))    
           {  
             if ((i!=0) && (a[i-1]>122 || a[i-1]<65 || (a[i-1]<97 && a[i-1]>90)))   
                 b=b+1;              
           }
         else if ((i==0) && (a[i]>122 || a[i]<65 || (a[i]<97 && a[i]>90)))
           b=0;    
       }  
    cout << b <<endl;     
   }  
return 0;  


#503: Re:我改過寫法,不過換成WA了


POOHccc ()


以下為code

#include <iostream>  
#include <cstring>  
using namespace std;  
int main()  
{  
 string a;     
 while (getline(cin,a))  
   {      
     int b=1;    
     for (int i=0;i<=(a.size()-1);i++)  
       {  
         if ((a[i]<122 && a[i]>97) || (a[i]>65 && a[i]<90))    
           {  
             if ((i!=0) && (a[i-1]>122 || a[i-1]<65 || (a[i-1]<97 && a[i-1]>90)))   
                 b=b+1;              
           }  
       }  
    cout << b <<endl;     
   }  
return 0;  
}

可以請教各位大大 我哪裡沒注意到嗎

或提供一組會使我的程式WA的測資給我

謝謝



asd...asd

正確答案為2 

#507: Re:我改過寫法,不過換成WA了


trewsla (trewsla)


以下為code

#include <iostream>   #include <cstring>   using namespace std;   int main()   {    string a;       while (getline(cin,a))      {            int b=1;          for (int i=0;i<=(a.size()-1);i++)          {            if ((a[i]<122 && a[i]>97) || (a[i]>65 && a[i]<90))                {                if ((i!=0) && (a[i-1]>122 || a[i-1]<65 || (a[i-1]<97 && a[i-1]>90)))                     b=b+1;                          }          }       cout << b <<endl;         }   return 0;   } 

可以請教各位大大 我哪裡沒注意到嗎

或提供一組會使我的程式WA的測資給我

謝謝

asd...asd

正確答案為2 

==========

總算過哩 謝謝大大

原來是少了等號 囧

感恩