F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_16388829_17499.cpp:2:1601: fatal error: GCC4.9.2/lib/gcc/x86_64-w64-mingw32/4.9.2/include/stdio.h>struc: Invalid argument
 #include <stdio.h>struct book{ int width, id; book *next;};    int s_width, cur_width, last_id;    void newhead(book *&head, int width, int id){ book *p = new book; p->width = width; p->id = id; p->next = head; head = p; cur_width += width;//增加现有宽度}void Delete(book *&head, int id){ book *p, *q; if(!cur_width) return;//空书架 if(head->id == id){//待删除的id在链首  p = head;  head = head->next;  cur_width -= p->width;  delete p; } else{  if(head->next == NULL) return;//待删除的id不存在  p = head;  while(p->next){   if((p->next)->id == id) break;   p = p->next;  }  if(p->next->next == NULL) last_id = p->id;  q = p->next;  p->next = q->next;  cur_width -= q->width;  delete q; }}void Free_list(book *&head){    book *p;    while(head){        p = head;        head = head->next;        delete p;    }    cur_width = 0;}int main(){ char act; int id, width, t = 0; cur_width = 0; book *head, *p; while(scanf("%d", &s_width) && s_width+1) {  head = NULL;  while(scanf("%c", &act) && act!=’E')  {   if(act == ‘A’)//增加数目   {    scanf("%d%d", &id, &width);    if(!cur_width) last_id = id;//记录最后一本书的ID    newhead(head, width, id);    while(cur_width > s_width) Delete(head, last_id); //反复挤出最后一本书,直到书的总宽度小于书架   }   else if(act == ‘R’)//移除数目   {    scanf("%d", &id);    Delete(head, id);   }  }  printf("PROBLEM %d:", ++t);  p = head;  while(p)//打印剩余的书目  {   printf(" %d", p->id);   p = p->next;  }  printf("\n");  Free_list(head);//删除链表 } return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
compilation terminated.


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-16 16:34:15, Gzip enabled