Language: C

Last login: Tue May 02 2017 23:42:11 +0900 from KD106154090090
Oracle Corporation     SunOS 5.11      11.3    January 2017

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Solaris11:
  - Computer Exercise Room 1 and 2  ... std1dc2 - std1dc46, std2dc2 - std2dc46
  - Computer Exercise Room 3 and 4  ... std34rsv1 - std34rsv5
  - Standard Environment Server     ... solsv171 - solsv174
- OS X 10.9:
  - Computer Exercise Room 5 and 6  ... std5dc2 - std5dc50, std6dc2 - std6dc50
  - iLab 1 and 2                ... ilab1dc2 - ilab1dc49, ilab2dc2 - ilab2dc49
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sshsv172{s1240136}51: cd Algo1/Lec03/
sshsv172{s1240136}52: emacs B.c


















































































Last login: Tue May 02 2017 23:42:11 +0900 from KD106154090090
Oracle Corporation     SunOS 5.11      11.3    January 2017

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Solaris11:
  - Computer Exercise Room 1 and 2  ... std1dc2 - std1dc46, std2dc2 - std2dc46
  - Computer Exercise Room 3 and 4  ... std34rsv1 - std34rsv5
  - Standard Environment Server     ... solsv171 - solsv174
- OS X 10.9:
  - Computer Exercise Room 5 and 6  ... std5dc2 - std5dc50, std6dc2 - std6dc50
  - iLab 1 and 2                ... ilab1dc2 - ilab1dc49, ilab2dc2 - ilab2dc49
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sshsv172{s1240136}51: cd Algo1/Lec03/
sshsv172{s1240136}52: emacs B.c


































File Edit Options Buffers Tools C Help
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct{
  char name[10];
  int time;
}set;
struct node{
  set data;
  struct node *next;
};
struct node* insert(set);
struct node* finditem(set);
struct node* make_1node(set,struct node*);
void delnode(struct node*);
struct node *head;

int main(){
  int n, q, time=0, i; //n->?????° q->??????????????? time->????????????
  char c,cc;
-UUU:**--F1  B.c            Top L4     (C/l Abbrev) 11:42PM 21.83 --------------









































File Edit Options Buffers Tools Minibuf Help
  struct node *m, *lastnode;
  /*scanf("%c",&c);
  if(c >= '0' && c <= '9'){
    n = atoi(&c);
    while(c != ' '){
      scanf("%c",&c);
      n = 10 * n + atoi(&c);
    }
  */
  if(1){
    scanf("%d",&n);
    head = make_1node(input,NULL);
    scanf("%d",&q);
    for(i=0; i<n; i++){
      scanf("%s%d",input.name,&input.time);
      lastnode = insert(input);
    }
    while(n){
      m = head->next;
      if(m->data.time > q){
        time += q;
        m->data.time -= q;
        //???????????????-->???????°??????????
        lastnode->next = m;
        lastnode = m;
        head->next = m->next;
        m->next = NULL;
      }
      else{
        time += m->data.time;
        m->data.time = 0;
        printf("%s %d\n",m->data.name,time);
        head->next = m->next;
        free(m);
        n--;
      }
    }
-UUU:**--F1  B.c            21% L43    (C/l Abbrev) 11:43PM 21.78 --------------

Last login: Tue May 02 2017 23:42:11 +0900 from KD106154090090
Oracle Corporation     SunOS 5.11      11.3    January 2017

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Solaris11:
  - Computer Exercise Room 1 and 2  ... std1dc2 - std1dc46, std2dc2 - std2dc46
  - Computer Exercise Room 3 and 4  ... std34rsv1 - std34rsv5
  - Standard Environment Server     ... solsv171 - solsv174
- OS X 10.9:
  - Computer Exercise Room 5 and 6  ... std5dc2 - std5dc50, std6dc2 - std6dc50
  - iLab 1 and 2                ... ilab1dc2 - ilab1dc49, ilab2dc2 - ilab2dc49
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sshsv172{s1240136}51: cd Algo1/Lec03/
sshsv172{s1240136}52: emacs B.c
sshsv172{s1240136}53: gcc B.c
sshsv172{s1240136}54: ./a.out
















































5 100
p1 150
p2 400
^C
sshsv172{s1240136}55: ./a.out
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
p2 180
p5 400
p1 450
p3 550
p4 800
sshsv172{s1240136}56: emacs B.c











































































































































5 100
p1 150
p2 400
^C
sshsv172{s1240136}55: ./a.out
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
p2 180
p5 400
p1 450
p3 550
p4 800
sshsv172{s1240136}56: emacs B.c





























































File Edit Options Buffers Tools Minibuf Help
      lastnode = insert(input);
    }
    while(n){
      m = head->next;
      if(m->data.time > q){
        time += q;
        m->data.time -= q;
        //????????´??°
        lastnode->next = m;
        lastnode = m;
        head->next = m->next;
        m->next = NULL;
      }
      else{
        time += m->data.time;
        m->data.time = 0;
        printf("%s %d\n",m->data.name,time);
        head->next = m->next;
        free(m);
        n--;
      }
    }
    for(m=head->next; m!=NULL; m=m->next)
      printf("%s %d\n",m->data.name,m->data.time);
  }
  else
    {
      while(c != '\n'){
        printf("%c",c);
        scanf("%c",&c);
      }
      printf("\n");
    }
  return 0;

}
-UUU:**--F1  B.c            38% L46    (C/l Abbrev) 11:52PM 21.66 -----------------

5 100
p1 150
p2 400
^C
sshsv172{s1240136}55: ./a.out
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
p2 180
p5 400
p1 450
p3 550
p4 800
sshsv172{s1240136}56: emacs B.c
sshsv172{s1240136}57: ./a.out
too large
^C
sshsv172{s1240136}58: emacs B.c







































































































































5 100
p1 150
p2 400
^C
sshsv172{s1240136}55: ./a.out
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
p2 180
p5 400
p1 450
p3 550
p4 800
sshsv172{s1240136}56: emacs B.c
sshsv172{s1240136}57: ./a.out
too large
^C
sshsv172{s1240136}58: emacs B.c

























































File Edit Options Buffers Tools C Help
        printf("%s %d\n",m->data.name,time);
        head->next = m->next;
        free(m);
        n--;
      }
    }
    for(m=head->next; m!=NULL; m=m->next)
      printf("%s %d\n",m->data.name,m->data.time);
  }
  else
    {
      while(1){
        printf("%c",c);
        scanf("%c",&c);
        if(c == '\n') break;
      }
      printf("\n");
    }
  return 0;

}

struct node* insert(set keydata)
{
  struct node *newnode;
  struct node *n;
  if (finditem(keydata) == NULL) {
    n = head;
    while(n->next != NULL)
      n = n->next;
    newnode = make_1node(keydata, n);
    n->next = newnode;
    newnode->next = NULL;
    return newnode;
  }
  else return NULL;
-UUU:----F1  B.c            52% L69    (C/l Abbrev) 11:56PM 22.26 -----------------

5 100
p1 150
p2 400
^C
sshsv172{s1240136}55: ./a.out
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
p2 180
p5 400
p1 450
p3 550
p4 800
sshsv172{s1240136}56: emacs B.c
sshsv172{s1240136}57: ./a.out
too large
^C
sshsv172{s1240136}58: emacs B.c
sshsv172{s1240136}59: gcc B.c
sshsv172{s1240136}60: ./a.out
too
too
sshsv172{s1240136}61: ./a.out
too large
too large
sshsv172{s1240136}62: emacs B.c































































































































5 100
p1 150
p2 400
^C
sshsv172{s1240136}55: ./a.out
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
p2 180
p5 400
p1 450
p3 550
p4 800
sshsv172{s1240136}56: emacs B.c
sshsv172{s1240136}57: ./a.out
too large
^C
sshsv172{s1240136}58: emacs B.c
sshsv172{s1240136}59: gcc B.c
sshsv172{s1240136}60: ./a.out
too
too
sshsv172{s1240136}61: ./a.out
too large
too large
sshsv172{s1240136}62: emacs B.c

















































File Edit Options Buffers Tools C Help
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct{
  char name[10];
  int time;
}set;
struct node{
  set data;
  struct node *next;
};
struct node* insert(set);
struct node* finditem(set);
struct node* make_1node(set,struct node*);
void delnode(struct node*);
struct node *head;

int main(){
  int n, q, time=0, i; //n->?????° q->??????????????? time->????????????
  char c,cc;
  set input={{1,1},0}; //head??????????????¨??\???????????¨
  struct node *m, *lastnode;
  scanf("%c",&c);
  if(c >= '0' && c <= '9'){
    n = atoi(&c);
    while(1){
      scanf("%c",&c);
      if(c == ' ') break;
      n = 10 * n + atoi(&c);
    }

    //if(1){
    //scanf("%d",&n);
    head = make_1node(input,NULL);
    scanf("%d",&q);
-UUU:**--F1  B.c            Top L28    (C/l Abbrev) 11:58PM 22.16 -----------------
Auto-saving...done







































File Edit Options Buffers Tools Minibuf Help
    newnode->next = NULL;
    return newnode;
  }
  else return NULL;
}

struct node* finditem(set keydata)
{
  struct node *n;
  int flag;
  for (n = head; n->next != NULL; n = n->next) {
    if (strcmp(n->next->data.name, keydata.name) == 0) return n;
  }
  return NULL;
}

struct node* make_1node(set keydata, struct node *p)
{
  struct node *n;
  n = (struct node*)malloc(sizeof(struct node));
  n->data = keydata;
  n->next = p;
  return n;
}












-UUU:**--F1  B.c            Bot L107   (C/l Abbrev) 12:01AM 22.14 -------------------

5 100
p1 150
p2 400
^C
sshsv172{s1240136}55: ./a.out
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
p2 180
p5 400
p1 450
p3 550
p4 800
sshsv172{s1240136}56: emacs B.c
sshsv172{s1240136}57: ./a.out
too large
^C
sshsv172{s1240136}58: emacs B.c
sshsv172{s1240136}59: gcc B.c
sshsv172{s1240136}60: ./a.out
too
too
sshsv172{s1240136}61: ./a.out
too large
too large
sshsv172{s1240136}62: emacs B.c
sshsv172{s1240136}63: ./a.out
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
p2 180
p5 400
p1 450
p3 550
p4 800
sshsv172{s1240136}64: emacs B.c






















































































































sshsv172{s1240136}55: ./a.out
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
p2 180
p5 400
p1 450
p3 550
p4 800
sshsv172{s1240136}56: emacs B.c
sshsv172{s1240136}57: ./a.out
too large
^C
sshsv172{s1240136}58: emacs B.c
sshsv172{s1240136}59: gcc B.c
sshsv172{s1240136}60: ./a.out
too
too
sshsv172{s1240136}61: ./a.out
too large
too large
sshsv172{s1240136}62: emacs B.c
sshsv172{s1240136}63: ./a.out
5 100
p1 150
p2 80
p3 200
p4 350
p5 20
p2 180
p5 400
p1 450
p3 550
p4 800
sshsv172{s1240136}64: emacs B.c








































File Edit Options Buffers Tools C Help
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct{
  char name[10];
  int time;
}set;
struct node{
  set data;
  struct node *next;
};
struct node* insert(set);
struct node* finditem(set);
struct node* make_1node(set,struct node*);
void delnode(struct node*);
struct node *head;

int main(){
  int n, q, time=0, i; //n->?????° q->??????????????? time->????????????
  char c,cc;
  set input={{1,1},0}; //head??????????????¨??\???????????¨
  struct node *m, *lastnode;
  scanf("%c",&c);
  if(c >= '0' && c <= '9'){
    n = atoi(&c);
    while(1){
      scanf("%c",&c);
      if(c == ' ') break;
      n = 10 * n + atoi(&c);
    }

    //if(1){
    //scanf("%d",&n);
    head = make_1node(input,NULL);
    scanf("%d",&q);
-UUU:**--F1  B.c            Top L1     (C/l Abbrev) 12:02AM 22.16 -------------------
B.c has auto save data; consider M-x recover-this-file

Compiler output:
main.c:1:1: error: unknown type name 'Last'
    1 | Last login: Tue May 02 2017 23:42:11 +0900 from KD106154090090
      | ^~~~
main.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
    1 | Last login: Tue May 02 2017 23:42:11 +0900 from KD106154090090
      |           ^
main.c:1:39: error: invalid digit "9" in octal constant
    1 | Last login: Tue May 02 2017 23:42:11 +0900 from KD106154090090
      |                                       ^~~~
main.c:13:19: error: expected identifier or '(' before numeric constant
   13 | sshsv172{s1240136}51: cd Algo1/Lec03/
      |                   ^~
main.c:14:19: error: expected identifier or '(' before numeric constant
   14 | sshsv172{s1240136}52: emacs B.c
      |                   ^~
main.c:97:39: error: invalid digit "9" in octal constant
   97 | Last login: Tue May 02 2017 23:42:11 +0900 from KD106154090090
      |                                       ^~~~
main.c:109:19: error: expected identifier or '(' before numeric constant
  109 | sshsv172{s1240136}51: cd Algo1/Lec03/
      |                   ^~
main.c:110:19: error: expected identifier or '(' before numeric constant
  110 | sshsv172{s1240136}52: emacs B.c
      |                   ^~
In file included from /usr/include/stdio.h:47,
                 from main.c:146:
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:28:43: error: unknown type name 'size_t'
   28 |                                           size_t __nbytes);
      |                                           ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
  +++ |+#include <stddef.h>
    1 | /* Copyright (C) 1991-2025 Free Software Foundation, Inc.
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: error: unknown type name 'size_t'
   37 |                                            size_t __nbytes);
      |                                            ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:57:3: error: unknown type name 'cookie_read_function_t'; did you mean 'cookie_seek_function_t'?
   57 |   cookie_read_function_t *read;         /* Read bytes.  */
      |   ^~~~~~~~~~~~~~~~~~~~~~
      |   cookie_seek_function_t
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:58:3: error: unknown type name 'cookie_write_function_t'; did you mean 'cookie_close_function_t'?
   58 |   cookie_write_function_t *write;       /* Write bytes.  */
      |   ^~~~~~~~~~~~~~~~~~~~~~~
      |   cookie_close_function_t
/usr/include/stdio.h:314:35: error: unknown type name 'size_t'
  314 | extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
      |                                   ^~~~~~
/usr/include/stdio.h:130:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
  129 | #include <bits/stdio_lim.h>
  +++ |+#include <stddef.h>
  130 | 
/usr/include/stdio.h:320:47: error: unknown type name 'size_t'
  320 | extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW
      |                                               ^~~~~~
/usr/include/stdio.h:320:47: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:340:34: error: unknown type name 'size_t'
  340 |                     int __modes, size_t __n) __THROW __nonnull ((1));
      |                                  ^~~~~~
/usr/include/stdio.h:340:34: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:346:24: error: unknown type name 'size_t'
  346 |                        size_t __size) __THROW __nonnull ((1));
      |                        ^~~~~~
/usr/include/stdio.h:346:24: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:385:44: error: unknown type name 'size_t'
  385 | extern int snprintf (char *__restrict __s, size_t __maxlen,
      |                                            ^~~~~~
/usr/include/stdio.h:385:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:389:45: error: unknown type name 'size_t'
  389 | extern int vsnprintf (char *__restrict __s, size_t __maxlen,
      |                                             ^~~~~~
/usr/include/stdio.h:389:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:690:30: error: unknown type name 'size_t'
  690 |                              size_t *__restrict __n, int __delimiter,
      |                              ^~~~~~
/usr/include/stdio.h:690:30: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:693:28: error: unknown type name 'size_t'
  693 |                            size_t *__restrict __n, int __delimiter,
      |                            ^~~~~~
/usr/include/stdio.h:693:28: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:698:27: error: unknown type name 'size_t'
  698 |                           size_t *__restrict __n,
      |                           ^~~~~~
/usr/include/stdio.h:698:27: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:728:8: error: unknown type name 'size_t'
  728 | extern size_t fread (void *__restrict __ptr, size_t __size,
      |        ^~~~~~
/usr/include/stdio.h:728:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:728:46: error: unknown type name 'size_t'
  728 | extern size_t fread (void *__restrict __ptr, size_t __size,
      |                                              ^~~~~~
/usr/include/stdio.h:728:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:729:22: error: unknown type name 'size_t'
  729 |                      size_t __n, FILE *__restrict __stream) __wur
      |                      ^~~~~~
/usr/include/stdio.h:729:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:735:8: error: unknown type name 'size_t'
  735 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
      |        ^~~~~~
/usr/include/stdio.h:735:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:735:53: error: unknown type name 'size_t'
  735 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
      |                                                     ^~~~~~
/usr/include/stdio.h:735:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:736:23: error: unknown type name 'size_t'
  736 |                       size_t __n, FILE *__restrict __s) __nonnull((4));
      |                       ^~~~~~
/usr/include/stdio.h:736:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:756:8: error: unknown type name 'size_t'
  756 | extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
      |        ^~~~~~
/usr/include/stdio.h:756:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:756:55: error: unknown type name 'size_t'
  756 | extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
      |                                                       ^~~~~~
/usr/include/stdio.h:756:55: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:757:31: error: unknown type name 'size_t'
  757 |                               size_t __n, FILE *__restrict __stream) __wur
      |                               ^~~~~~
/usr/include/stdio.h:757:31: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:759:8: error: unknown type name 'size_t'
  759 | extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
      |        ^~~~~~
/usr/include/stdio.h:759:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:759:62: error: unknown type name 'size_t'
  759 | extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
      |                                                              ^~~~~~
/usr/include/stdio.h:759:62: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:760:32: error: unknown type name 'size_t'
  760 |                                size_t __n, FILE *__restrict __stream)
      |                                ^~~~~~
/usr/include/stdio.h:760:32: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
In file included from main.c:147:
/usr/include/stdlib.h:98:8: error: unknown type name 'size_t'
   98 | extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
      |        ^~~~~~
/usr/include/stdlib.h:42:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
   41 | # include <bits/waitstatus.h>
  +++ |+#include <stddef.h>
   42 | 
/usr/include/stdlib.h:531:25: error: unknown type name 'size_t'
  531 |                         size_t __statelen) __THROW __nonnull ((2));
      |                         ^~~~~~
/usr/include/stdlib.h:531:25: note: 'size_t' is defin