#18976: 想請教一下><


easylin0126@gmail.com (林榮翼)

學校 : 臺北市立成功高級中學
編號 : 89424
來源 : [140.114.207.162]
最後登入時間 :
2023-09-27 16:33:24
a080. NOI2000 Day2.1.单词查找树 -- NOI2000Day2第一题 | From: [39.10.190.29] | 發表日期 : 2019-08-20 21:07

我的程式碼在DEV-C++上執行會一直return value 3221225477,結果送出答案後竟然AC了!!

想請問一下是哪邊出錯??

以下是我的程式碼:

#include<stdio.h>
struct Node{
    Node *node[26];
};
int main(){
    int i,len,ans=0;
    char str[65];
    Node *root=new Node,*temp;
    while(~scanf(" %s",str)){
        temp=root;
        for(i=0;str[i];i++){
            if(!temp->node[str[i]-'A']){
                ans++;
                temp->node[str[i]-'A']=new Node;
            }
            temp=temp->node[str[i]-'A'];
        }
    }
    printf("%d\n",ans+1);
}

 
ZeroJudge Forum