【問題】 ACM Q494 WA


Recommended Posts

下面是我的程式碼

#include <stdio.h>

int main(int argc, char *argv[])
{
int k=0;
char flag=0,ic=1;
while(1){
k=0;
ic=fgetc(stdin);
while(ic != '\n' && ic != EOF){

if((ic >= 65 && ic <=90) || (ic >= 97 && ic <= 122))
flag = 1;
else if (flag){
flag = 0;
k++;
}
ic=fgetc(stdin);
}
if (flag){
flag = 0;
k++;
}
printf("%d\n",k);
if (ic == EOF)break;
}
return 0;
}

我在懷疑是否是fgetc惹的禍

鏈接文章
分享到其他網站
  • 5 weeks later...

Hmmm...

I wrote by C language and I got AC.

I have studied your code.

Although we use same language,our writing way are still different.

So I'm not understood how you wrote clearly.

I'll PM you my code which got AC.

Just for you to reference.

Enjoy it!

P.S. I always use English in Program writing or chatting because of this Web:

http://acm.uva.es/board/index.php

Try to find answer though this large data library.

鏈接文章
分享到其他網站
  • 3 weeks later...

請登入後來留意見

在登入之後,您才能留意見



立即登入