submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s453755810
p00105
C
#include <stdio.h> #include <stdlib.h> struct word{ char w[31]; int p; }w[1000]; int compare(const void *a,const void *b){ int i; for(i=0;;i++){ if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; if((struct word *)a->w[i]!=(struct word *)b->w[i]){ return (struct word *)a->w[i]-(struct word *)b->w[i]; } } return 0; } int main(void) { int i=0,j,d; char s; while(scanf("%s%d",w[i].w,&(w[i++].d))); qsort(w,i,sizeof(struct word),compare); for(j=0;j<i;j++){ printf("%s %d",w[j].w,w[j].p); for(k=j+1;strcmp(w[j].w,w[k].w)==0;k++){ printf(" %d",w[k].p); } puts(""); j=k-1; } i=0; } return 0; }
main.c: In function 'compare': main.c:12:24: warning: dereferencing 'void *' pointer 12 | if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; | ^~ main.c:12:24: error: request for member 'w' in something not a structure or union main.c:12:54: warning: dereferencing 'void *' pointer 12 | if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; | ^~ main.c:12:54: error: request for member 'w' in something not a structure or union main.c:13:24: warning: dereferencing 'void *' pointer 13 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; | ^~ main.c:13:24: error: request for member 'w' in something not a structure or union main.c:13:54: warning: dereferencing 'void *' pointer 13 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; | ^~ main.c:13:54: error: request for member 'w' in something not a structure or union main.c:14:24: warning: dereferencing 'void *' pointer 14 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; | ^~ main.c:14:24: error: request for member 'w' in something not a structure or union main.c:14:54: warning: dereferencing 'void *' pointer 14 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; | ^~ main.c:14:54: error: request for member 'w' in something not a structure or union main.c:15:24: warning: dereferencing 'void *' pointer 15 | if((struct word *)a->w[i]!=(struct word *)b->w[i]){ | ^~ main.c:15:24: error: request for member 'w' in something not a structure or union main.c:15:48: warning: dereferencing 'void *' pointer 15 | if((struct word *)a->w[i]!=(struct word *)b->w[i]){ | ^~ main.c:15:48: error: request for member 'w' in something not a structure or union main.c:16:30: warning: dereferencing 'void *' pointer 16 | return (struct word *)a->w[i]-(struct word *)b->w[i]; | ^~ main.c:16:30: error: request for member 'w' in something not a structure or union main.c:16:53: warning: dereferencing 'void *' pointer 16 | return (struct word *)a->w[i]-(struct word *)b->w[i]; | ^~ main.c:16:53: error: request for member 'w' in something not a structure or union main.c: In function 'main': main.c:26:37: error: 'struct word' has no member named 'd' 26 | while(scanf("%s%d",w[i].w,&(w[i++].d))); | ^ main.c:31:9: error: 'k' undeclared (first use in this function) 31 | for(k=j+1;strcmp(w[j].w,w[k].w)==0;k++){ | ^ main.c:31:9: note: each undeclared identifier is reported only once for each function it appears in main.c:31:15: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] 31 | for(k=j+1;strcmp(w[j].w,w[k].w)==0;k++){ | ^~~~~~ main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp' 2 | #include <stdlib.h> +++ |+#include <string.h> 3 | main.c: At top level: main.c:40:3: error: expected identifier or '(' before 'return' 40 | return 0; | ^~~~~~ main.c:41:1: error: expected identifier or '(' before '}' token 41 | } | ^
s651385971
p00105
C
#include <stdio.h> #include <stdlib.h> struct word{ char w[31]; int p; }wo[1000]; int compare(const void *a,const void *b){ int i; for(i=0;;i++){ if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; if((struct word *)a->w[i]!=(struct word *)b->w[i]){ return (struct word *)a->w[i]-(struct word *)b->w[i]; } } return 0; } int main(void) { int i=0,j,d; char s; while(scanf("%s%d",wo[i].w,&(wo[i++].d))); qsort(wo,i,sizeof(struct word),compare); for(j=0;j<i;j++){ printf("%s %d",wo[j].w,wo[j].p); for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ printf(" %d",wo[k].p); } puts(""); j=k-1; } i=0; } return 0; }
main.c: In function 'compare': main.c:12:24: warning: dereferencing 'void *' pointer 12 | if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; | ^~ main.c:12:24: error: request for member 'w' in something not a structure or union main.c:12:54: warning: dereferencing 'void *' pointer 12 | if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; | ^~ main.c:12:54: error: request for member 'w' in something not a structure or union main.c:13:24: warning: dereferencing 'void *' pointer 13 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; | ^~ main.c:13:24: error: request for member 'w' in something not a structure or union main.c:13:54: warning: dereferencing 'void *' pointer 13 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; | ^~ main.c:13:54: error: request for member 'w' in something not a structure or union main.c:14:24: warning: dereferencing 'void *' pointer 14 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; | ^~ main.c:14:24: error: request for member 'w' in something not a structure or union main.c:14:54: warning: dereferencing 'void *' pointer 14 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; | ^~ main.c:14:54: error: request for member 'w' in something not a structure or union main.c:15:24: warning: dereferencing 'void *' pointer 15 | if((struct word *)a->w[i]!=(struct word *)b->w[i]){ | ^~ main.c:15:24: error: request for member 'w' in something not a structure or union main.c:15:48: warning: dereferencing 'void *' pointer 15 | if((struct word *)a->w[i]!=(struct word *)b->w[i]){ | ^~ main.c:15:48: error: request for member 'w' in something not a structure or union main.c:16:30: warning: dereferencing 'void *' pointer 16 | return (struct word *)a->w[i]-(struct word *)b->w[i]; | ^~ main.c:16:30: error: request for member 'w' in something not a structure or union main.c:16:53: warning: dereferencing 'void *' pointer 16 | return (struct word *)a->w[i]-(struct word *)b->w[i]; | ^~ main.c:16:53: error: request for member 'w' in something not a structure or union main.c: In function 'main': main.c:26:39: error: 'struct word' has no member named 'd' 26 | while(scanf("%s%d",wo[i].w,&(wo[i++].d))); | ^ main.c:31:9: error: 'k' undeclared (first use in this function) 31 | for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ | ^ main.c:31:9: note: each undeclared identifier is reported only once for each function it appears in main.c:31:15: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] 31 | for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ | ^~~~~~ main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp' 2 | #include <stdlib.h> +++ |+#include <string.h> 3 | main.c: At top level: main.c:40:3: error: expected identifier or '(' before 'return' 40 | return 0; | ^~~~~~ main.c:41:1: error: expected identifier or '(' before '}' token 41 | } | ^
s184392522
p00105
C
#include <stdio.h> #include <stdlib.h> struct word{ char w[31]; int p; }wo[1000]; int compare(const void *a,const void *b){ int i; for(i=0;;i++){ if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; if((struct word *)a->w[i]!=(struct word *)b->w[i]){ return (struct word *)a->w[i]-(struct word *)b->w[i]; } } return 0; } int main(void) { int i=0,j,d; char s; while(scanf("%s%d",wo[i].w,&(wo[i++].d))); qsort(wo,i,sizeof(struct word),compare); for(j=0;j<i;j++){ printf("%s %d",wo[j].w,wo[j].p); for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ printf(" %d",wo[k].p); } puts(""); j=k-1; } i=0; } return 0; }
main.c: In function 'compare': main.c:12:24: warning: dereferencing 'void *' pointer 12 | if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; | ^~ main.c:12:24: error: request for member 'w' in something not a structure or union main.c:12:54: warning: dereferencing 'void *' pointer 12 | if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; | ^~ main.c:12:54: error: request for member 'w' in something not a structure or union main.c:13:24: warning: dereferencing 'void *' pointer 13 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; | ^~ main.c:13:24: error: request for member 'w' in something not a structure or union main.c:13:54: warning: dereferencing 'void *' pointer 13 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; | ^~ main.c:13:54: error: request for member 'w' in something not a structure or union main.c:14:24: warning: dereferencing 'void *' pointer 14 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; | ^~ main.c:14:24: error: request for member 'w' in something not a structure or union main.c:14:54: warning: dereferencing 'void *' pointer 14 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; | ^~ main.c:14:54: error: request for member 'w' in something not a structure or union main.c:15:24: warning: dereferencing 'void *' pointer 15 | if((struct word *)a->w[i]!=(struct word *)b->w[i]){ | ^~ main.c:15:24: error: request for member 'w' in something not a structure or union main.c:15:48: warning: dereferencing 'void *' pointer 15 | if((struct word *)a->w[i]!=(struct word *)b->w[i]){ | ^~ main.c:15:48: error: request for member 'w' in something not a structure or union main.c:16:30: warning: dereferencing 'void *' pointer 16 | return (struct word *)a->w[i]-(struct word *)b->w[i]; | ^~ main.c:16:30: error: request for member 'w' in something not a structure or union main.c:16:53: warning: dereferencing 'void *' pointer 16 | return (struct word *)a->w[i]-(struct word *)b->w[i]; | ^~ main.c:16:53: error: request for member 'w' in something not a structure or union main.c: In function 'main': main.c:26:39: error: 'struct word' has no member named 'd' 26 | while(scanf("%s%d",wo[i].w,&(wo[i++].d))); | ^ main.c:31:9: error: 'k' undeclared (first use in this function) 31 | for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ | ^ main.c:31:9: note: each undeclared identifier is reported only once for each function it appears in main.c:31:15: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] 31 | for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ | ^~~~~~ main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp' 2 | #include <stdlib.h> +++ |+#include <string.h> 3 | main.c: At top level: main.c:40:3: error: expected identifier or '(' before 'return' 40 | return 0; | ^~~~~~ main.c:41:1: error: expected identifier or '(' before '}' token 41 | } | ^
s464823066
p00105
C
#include <stdio.h> #include <stdlib.h> struct word{ char w[31]; int p; }wo[1000]; int compare(const void *a,const void *b){ int i; for(i=0;;i++){ if(((struct word *)a)->w[i]!='\0'&&((struct word *)b)->w[i]=='\0')return -1; if(((struct word *)a)->w[i]=='\0'&&((struct word *)b)->w[i]!='\0')return 1; if(((struct word *)a)->w[i]=='\0'&&((struct word *)b)->w[i]=='\0')return 0; if(((struct word *)a)->w[i]!=((struct word *)b)->w[i]){ return ((struct word *)a)->w[i]-((struct word *)b)->w[i]; } } return 0; } int main(void) { int i=0,j,d; char s; while(scanf("%s%d",wo[i].w,&(wo[i++].d))); qsort(wo,i,sizeof(struct word),compare); for(j=0;j<i;j++){ printf("%s %d",wo[j].w,wo[j].p); for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ printf(" %d",wo[k].p); } puts(""); j=k-1; } i=0; } return 0; }
main.c: In function 'main': main.c:26:39: error: 'struct word' has no member named 'd' 26 | while(scanf("%s%d",wo[i].w,&(wo[i++].d))); | ^ main.c:31:9: error: 'k' undeclared (first use in this function) 31 | for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ | ^ main.c:31:9: note: each undeclared identifier is reported only once for each function it appears in main.c:31:15: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] 31 | for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ | ^~~~~~ main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp' 2 | #include <stdlib.h> +++ |+#include <string.h> 3 | main.c: At top level: main.c:40:3: error: expected identifier or '(' before 'return' 40 | return 0; | ^~~~~~ main.c:41:1: error: expected identifier or '(' before '}' token 41 | } | ^
s618660251
p00105
C
#include <stdio.h> #include <stdlib.h> struct word{ char w[31]; int p; }wo[1000]; int compare(const void *a,const void *b){ int i; for(i=0;;i++){ if(((struct word *)a)->w[i]!='\0'&&((struct word *)b)->w[i]=='\0')return -1; if(((struct word *)a)->w[i]=='\0'&&((struct word *)b)->w[i]!='\0')return 1; if(((struct word *)a)->w[i]=='\0'&&((struct word *)b)->w[i]=='\0')return 0; if(((struct word *)a)->w[i]!=((struct word *)b)->w[i]){ return ((struct word *)a)->w[i]-((struct word *)b)->w[i]; } } return 0; } int main(void) { int i=0,j,k,d; char s; while(scanf("%s%d",wo[i].w,&(wo[i++].p))); qsort(wo,i,sizeof(struct word),compare); for(j=0;j<i;j++){ printf("%s %d",wo[j].w,wo[j].p); for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ printf(" %d",wo[k].p); } puts(""); j=k-1; } i=0; } return 0; }
main.c: In function 'main': main.c:31:15: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] 31 | for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){ | ^~~~~~ main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp' 2 | #include <stdlib.h> +++ |+#include <string.h> 3 | main.c: At top level: main.c:40:3: error: expected identifier or '(' before 'return' 40 | return 0; | ^~~~~~ main.c:41:1: error: expected identifier or '(' before '}' token 41 | } | ^
s673724224
p00105
C
#include <stdio.h> #include <stdlib.h> struct word{ char w[31]; int p; }w[1000]; int compare(const void *a,const void *b){ int i; for(i=0;;i++){ if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; if((struct word *)a->w[i]!=(struct word *)b->w[i]){ return (struct word *)a->w[i]-(struct word *)b->w[i]; } } return 0; } int main(void) { int i=0,j,d; char s; while(scanf("%s%d",w[i].w,&(w[i++].d))); qsort(w,i,sizeof(struct word),compare); for(j=0;j<i;j++){ printf("%s %d",w[j].w,w[j].p); for(k=j+1;strcmp(w[j].w,w[k].w)==0;k++){ printf(" %d",w[k].p); } puts(""); j=k-1; } i=0; } return 0; }
main.c: In function 'compare': main.c:12:24: warning: dereferencing 'void *' pointer 12 | if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; | ^~ main.c:12:24: error: request for member 'w' in something not a structure or union main.c:12:54: warning: dereferencing 'void *' pointer 12 | if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1; | ^~ main.c:12:54: error: request for member 'w' in something not a structure or union main.c:13:24: warning: dereferencing 'void *' pointer 13 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; | ^~ main.c:13:24: error: request for member 'w' in something not a structure or union main.c:13:54: warning: dereferencing 'void *' pointer 13 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1; | ^~ main.c:13:54: error: request for member 'w' in something not a structure or union main.c:14:24: warning: dereferencing 'void *' pointer 14 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; | ^~ main.c:14:24: error: request for member 'w' in something not a structure or union main.c:14:54: warning: dereferencing 'void *' pointer 14 | if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0; | ^~ main.c:14:54: error: request for member 'w' in something not a structure or union main.c:15:24: warning: dereferencing 'void *' pointer 15 | if((struct word *)a->w[i]!=(struct word *)b->w[i]){ | ^~ main.c:15:24: error: request for member 'w' in something not a structure or union main.c:15:48: warning: dereferencing 'void *' pointer 15 | if((struct word *)a->w[i]!=(struct word *)b->w[i]){ | ^~ main.c:15:48: error: request for member 'w' in something not a structure or union main.c:16:30: warning: dereferencing 'void *' pointer 16 | return (struct word *)a->w[i]-(struct word *)b->w[i]; | ^~ main.c:16:30: error: request for member 'w' in something not a structure or union main.c:16:53: warning: dereferencing 'void *' pointer 16 | return (struct word *)a->w[i]-(struct word *)b->w[i]; | ^~ main.c:16:53: error: request for member 'w' in something not a structure or union main.c: In function 'main': main.c:26:37: error: 'struct word' has no member named 'd' 26 | while(scanf("%s%d",w[i].w,&(w[i++].d))); | ^ main.c:31:9: error: 'k' undeclared (first use in this function) 31 | for(k=j+1;strcmp(w[j].w,w[k].w)==0;k++){ | ^ main.c:31:9: note: each undeclared identifier is reported only once for each function it appears in main.c:31:15: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] 31 | for(k=j+1;strcmp(w[j].w,w[k].w)==0;k++){ | ^~~~~~ main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp' 2 | #include <stdlib.h> +++ |+#include <string.h> 3 | main.c: At top level: main.c:40:3: error: expected identifier or '(' before 'return' 40 | return 0; | ^~~~~~ main.c:41:1: error: expected identifier or '(' before '}' token 41 | } | ^
s928431640
p00105
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct Words { char word[30]; int page[100]; } WORDS; WORDS wordArray[100]; WORDS* printMinWord(WORDS*); WORDS* printMinPage(WORDS*); int main() { char tempWord[30]; int tempPage; int wordCnt; int pageCnt; int inputCnt = 0; while (scanf("%s %d", tempWord", &tempPage) != EOF) { wordCnt = 0; /*sort page to each words*/ while(1) { if(!strcmp(tempWord, wordArray[wordCnt].word)) { for(pageCnt = 1; pageCnt < 100; pageCnt++) { if(!(wordArray[wordCnt].page[pageCnt])) { break; } } wordArray[wordCnt].page[pageCnt] = tempPage; break; } else if(!strcmp("", wordArray[wordCnt].word)) { strcpy(wordArray[wordCnt].word, tempWord); wordArray[wordCnt].page[0] = tempPage; break; } wordCnt++; } } printMinWord(wordArray); return 0; } WORDS* printMinWord(WORDS* word_array) { int word_cnt; char min_word[30] = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"; int min_word_index = -1; /*find min word and its index*/ for(word_cnt = 0; word_cnt < 100; word_cnt++) { if(!strcmp(word_array[word_cnt].word, "")) { continue; } if(strcmp(word_array[word_cnt].word, min_word) < 0) { strcpy(min_word, word_array[word_cnt].word); min_word_index = word_cnt; } } /*no recursion if no word content*/ if(min_word_index == -1) { return word_array; } printf("%s\n", word_array[min_word_index].word); /*print subsequential pages of min word*/ printMinPage(&word_array[min_word_index]); strcpy(word_array[min_word_index].word, ""); return printMinWord(word_array); } WORDS* printMinPage(WORDS* word_array) { int page_cnt; int min_page = 1001; int min_page_index = -1; /*find min page and its index*/ for(page_cnt = 0; page_cnt < 100; page_cnt++) { if(word_array->page[page_cnt] == 0) { continue; } if(word_array->page[page_cnt] < min_page) { min_page = word_array->page[page_cnt]; min_page_index = page_cnt; } } /*no recursion if no page content*/ if(min_page_index == -1) { printf("\n"); return word_array; } printf("%d", word_array->page[min_page_index]); word_array->page[min_page_index] = 0; for(page_cnt = 0; page_cnt < 100; page_cnt++) { if(word_array->page[page_cnt] == 0) { continue; } printf(" "); return printMinPage(word_array); } return printMinPage(word_array); }
main.c: In function 'main': main.c:24:35: warning: missing terminating " character 24 | while (scanf("%s %d", tempWord", &tempPage) != EOF) | ^ main.c:24:35: error: missing terminating " character 24 | while (scanf("%s %d", tempWord", &tempPage) != EOF) | ^~~~~~~~~~~~~~~~~~~~~ main.c:24:35: error: expected ')' before '{' token 24 | while (scanf("%s %d", tempWord", &tempPage) != EOF) | ~ ^ | ) 25 | { | ~ main.c:55:14: error: expected ')' before '}' token 55 | return 0; | ^ | ) 56 | } | ~ main.c:24:11: note: to match this '(' 24 | while (scanf("%s %d", tempWord", &tempPage) != EOF) | ^ main.c:56:1: error: expected expression before '}' token 56 | } | ^
s480474973
p00105
C
#include <stdio.h> #include <string.h> typedef int BOOL; #define TRUE 1; #define FALSE 0; typedef struct Word { char word[31]; int page; } WORD; WORD wordArray[100]; void input(); BOOL is_smaller(char *, int, int); void output(); int main() { input(); output(); return 0; } void input() { int cnt1, cnt2; char tempWord[31]; int tempPage; while(scanf("%s %d", tempWord, &tempPage) != EOF) { for(cnt1 = 0; cnt1 < 100; cnt1++) { if(wordArray[cnt1].page == 0) { wordArray[cnt1].page = tempPage; strcpy(wordArray[cnt1].word, tempWord); break; } else if(is_smaller(tempWord, tempPage, cnt1)) { for(cnt2 = 98; cnt2 >= cnt1; cnt2--) { strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word); wordArray[cnt2 + 1].page = wordArray[cnt2].page; } strcpy(wordArray[cnt1].word, tempWord); wordArray[cnt1].page = tempPage; break; } } } } BOOL is_smaller(char *tempWord, int input_page, int cnt) { if(strcmp(tempWord, wordArray[cnt].word) < 0) return TRUE; else if(strcmp(tempWord, wordArray[cnt].word) == 0) { if(input_page < wordArray[cnt].page) return TRUE; else return FALSE; } else return FALSE; } void output(WORD *wordArray) { int output_cnt = 0; char last_print_word[30] = ""; while(wordArray[output_cnt].page != 0) { if(strcmp(last_print_word, "") == 0) { printf("%s\n", wordArray[output_cnt].word); strcpy(last_print_word, wordArray[output_cnt].word); } else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0) { printf("\n%s\n", wordArray[output_cnt].word); strcpy(last_print_word, wordArray[output_cnt].word); } else { printf(" "); } printf("%d", wordArray[output_cnt].page); output_cnt++; } printf("\n"); }
main.c: In function 'is_smaller': main.c:63:9: error: 'else' without a previous 'if' 63 | else if(strcmp(tempWord, wordArray[cnt].word) == 0) | ^~~~ main.c:67:17: error: expected '}' before 'else' 67 | else | ^~~~ main.c: At top level: main.c:70:9: error: expected identifier or '(' before 'else' 70 | else | ^~~~ main.c:72:1: error: expected identifier or '(' before '}' token 72 | } | ^
s520017370
p00105
C
#include <stdio.h> #include <string.h> typedef int BOOL; #define TRUE 1; #define FALSE 0; typedef struct Word { char word[31]; int page; } WORD; WORD wordArray[100]; void input(); BOOL is_smaller(char *, int, int); void output(); int main() { input(); output(); return 0; } void input() { int cnt1, cnt2; char tempWord[31]; int tempPage; while(scanf("%s %d", tempWord, &tempPage) != EOF) { for(cnt1 = 0; cnt1 < 100; cnt1++) { if(wordArray[cnt1].page == 0) { wordArray[cnt1].page = tempPage; strcpy(wordArray[cnt1].word, tempWord); break; } else if(is_smaller(tempWord, tempPage, cnt1)) { for(cnt2 = 98; cnt2 >= cnt1; cnt2--) { strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word); wordArray[cnt2 + 1].page = wordArray[cnt2].page; } strcpy(wordArray[cnt1].word, tempWord); wordArray[cnt1].page = tempPage; break; } } } } BOOL is_smaller(char *tempWord, int input_page, int cnt) { if(strcmp(tempWord, wordArray[cnt].word) < 0) return TRUE; else if(strcmp(tempWord, wordArray[cnt].word) == 0) { if(input_page < wordArray[cnt].page) return TRUE; else { return FALSE; } } else { return FALSE; } } void output(WORD *wordArray) { int output_cnt = 0; char last_print_word[30] = ""; while(wordArray[output_cnt].page != 0) { if(strcmp(last_print_word, "") == 0) { printf("%s\n", wordArray[output_cnt].word); strcpy(last_print_word, wordArray[output_cnt].word); } else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0) { printf("\n%s\n", wordArray[output_cnt].word); strcpy(last_print_word, wordArray[output_cnt].word); } else { printf(" "); } printf("%d", wordArray[output_cnt].page); output_cnt++; } printf("\n"); }
main.c: In function 'is_smaller': main.c:63:9: error: 'else' without a previous 'if' 63 | else if(strcmp(tempWord, wordArray[cnt].word) == 0) | ^~~~ main.c:67:17: error: expected '}' before 'else' 67 | else | ^~~~ main.c: At top level: main.c:72:9: error: expected identifier or '(' before 'else' 72 | else | ^~~~ main.c:76:1: error: expected identifier or '(' before '}' token 76 | } | ^
s896633974
p00105
C
#include <stdio.h> #include <string.h> typedef int BOOL; #define TRUE 1; #define FALSE 0; typedef struct Word{ char word[31]; int page; } WORD; WORD wordArray[100]; void input(); BOOL is_smaller(WORD, int); void output(); int main() { input(); output(); return 0; } void input() { int cnt1, cnt2; WORD tempWORD; while(scanf("%s %d", tempWORD.word, &tempWORD.page) != EOF) for(cnt1 = 0; cnt1 < 100; cnt1++){ if(wordArray[cnt1].page == 0){ strcpy(wordArray[cnt1].word, tempWORD.word); wordArray[cnt1].page = tempWORD.page; break; } else if(is_smaller(tempWORD, cnt1)){ for(cnt2 = 98; cnt2 >= cnt1; cnt2--){ strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word); wordArray[cnt2 + 1].page = wordArray[cnt2].page; } strcpy(wordArray[cnt1].word, tempWORD.word); wordArray[cnt1].page = tempWORD.page; break; } } } BOOL is_smaller(WORD tempWORD, int cnt) { if(strcmp(tempWORD.word, wordArray[cnt].word) < 0) return TRUE; else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0) { if(tempWORD.page < wordArray[cnt].page) { return TRUE; } else { return FALSE; } } else { return FALSE; } } void output() { int output_cnt = 0; char last_print_word[31] = ""; while(wordArray[output_cnt].page != 0) { if(strcmp(last_print_word, "") == 0) { printf("%s\n", wordArray[output_cnt].word); strcpy(last_print_word, wordArray[output_cnt].word); } else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0) { printf("\n%s\n", wordArray[output_cnt].word); strcpy(last_print_word, wordArray[output_cnt].word); } else { printf(" "); } printf("%d", wordArray[output_cnt].page); output_cnt++; } printf("\n"); }
main.c: In function 'is_smaller': main.c:55:9: error: 'else' without a previous 'if' 55 | else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0) | ^~~~
s150090416
p00105
C
#include <stdio.h> #include <string.h> typedef int BOOL; #define TRUE 1; #define FALSE 0; typedef struct Word{ char word[31]; int page; } WORD; WORD wordArray[100]; void input(); BOOL is_smaller(WORD, int); void output(); #include <stdio.h> #include <string.h> typedef int BOOL; #define TRUE 1; #define FALSE 0; typedef struct Word{ char word[31]; int page; } WORD; WORD wordArray[100]; void input(); BOOL is_smaller(WORD, int); void output(); int main() { input(); output(); return 0; } void input() { int cnt1, cnt2; WORD tempWORD; while(scanf("%s %d", tempWORD.word, &tempWORD.page) != EOF) for(cnt1 = 0; cnt1 < 100; cnt1++){ if(wordArray[cnt1].page == 0){ strcpy(wordArray[cnt1].word, tempWORD.word); wordArray[cnt1].page = tempWORD.page; break; } else if(is_smaller(tempWORD, cnt1)){ for(cnt2 = 98; cnt2 >= cnt1; cnt2--){ strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word); wordArray[cnt2 + 1].page = wordArray[cnt2].page; } strcpy(wordArray[cnt1].word, tempWORD.word); wordArray[cnt1].page = tempWORD.page; break; } } } BOOL is_smaller(WORD tempWORD, int cnt) { if(strcmp(tempWORD.word, wordArray[cnt].word) < 0){ return TRUE; } else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0){ if(tempWORD.page < wordArray[cnt].page) { return TRUE; } else { return FALSE; } } else{ return FALSE; } } void output() { int output_cnt = 0; char last_print_word[31] = ""; while(wordArray[output_cnt].page != 0) { if(strcmp(last_print_word, "") == 0) { printf("%s\n", wordArray[output_cnt].word); strcpy(last_print_word, wordArray[output_cnt].word); } else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0) { printf("\n%s\n", wordArray[output_cnt].word); strcpy(last_print_word, wordArray[output_cnt].word); } else { printf(" "); } printf("%d", wordArray[output_cnt].page); output_cnt++; } printf("\n"); } int main() { input(); output(); return 0; } void input() { int cnt1, cnt2; WORD tempWORD; while(scanf("%s %d", tempWORD.word, &tempWORD.page) != EOF) for(cnt1 = 0; cnt1 < 100; cnt1++){ if(wordArray[cnt1].page == 0){ strcpy(wordArray[cnt1].word, tempWORD.word); wordArray[cnt1].page = tempWORD.page; break; } else if(is_smaller(tempWORD, cnt1)){ for(cnt2 = 98; cnt2 >= cnt1; cnt2--){ strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word); wordArray[cnt2 + 1].page = wordArray[cnt2].page; } strcpy(wordArray[cnt1].word, tempWORD.word); wordArray[cnt1].page = tempWORD.page; break; } } } BOOL is_smaller(WORD tempWORD, int cnt) { if(strcmp(tempWORD.word, wordArray[cnt].word) < 0) return TRUE; else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0) { if(tempWORD.page < wordArray[cnt].page) { return TRUE; } else { return FALSE; } } else { return FALSE; } } void output() { int output_cnt = 0; char last_print_word[31] = ""; while(wordArray[output_cnt].page != 0) { if(strcmp(last_print_word, "") == 0) { printf("%s\n", wordArray[output_cnt].word); strcpy(last_print_word, wordArray[output_cnt].word); } else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0) { printf("\n%s\n", wordArray[output_cnt].word); strcpy(last_print_word, wordArray[output_cnt].word); } else { printf(" "); } printf("%d", wordArray[output_cnt].page); output_cnt++; } printf("\n"); }
main.c:25:16: error: redefinition of 'struct Word' 25 | typedef struct Word{ | ^~~~ main.c:8:16: note: originally defined here 8 | typedef struct Word{ | ^~~~ main.c:28:9: error: conflicting types for 'WORD'; have 'struct Word' 28 | } WORD; | ^~~~ main.c:11:9: note: previous declaration of 'WORD' with type 'WORD' {aka 'struct Word'} 11 | } WORD; | ^~~~ main.c:30:6: error: conflicting types for 'wordArray'; have 'WORD[100]' {aka 'struct Word[100]'} 30 | WORD wordArray[100]; | ^~~~~~~~~ main.c:13:6: note: previous declaration of 'wordArray' with type 'WORD[100]' {aka 'struct Word[100]'} 13 | WORD wordArray[100]; | ^~~~~~~~~ main.c:33:14: error: conflicting types for 'is_smaller'; have 'BOOL(WORD, int)' {aka 'int(struct Word, int)'} 33 | BOOL is_smaller(WORD, int); | ^~~~~~~~~~ main.c:16:14: note: previous declaration of 'is_smaller' with type 'BOOL(WORD, int)' {aka 'int(struct Word, int)'} 16 | BOOL is_smaller(WORD, int); | ^~~~~~~~~~ main.c:68:6: error: conflicting types for 'is_smaller'; have 'BOOL(WORD, int)' {aka 'int(struct Word, int)'} 68 | BOOL is_smaller(WORD tempWORD, int cnt) | ^~~~~~~~~~ main.c:16:14: note: previous declaration of 'is_smaller' with type 'BOOL(WORD, int)' {aka 'int(struct Word, int)'} 16 | BOOL is_smaller(WORD, int); | ^~~~~~~~~~ main.c:114:5: error: redefinition of 'main' 114 | int main() | ^~~~ main.c:36:5: note: previous definition of 'main' with type 'int()' 36 | int main() | ^~~~ main.c:122:6: error: redefinition of 'input' 122 | void input() | ^~~~~ main.c:44:6: note: previous definition of 'input' with type 'void()' 44 | void input() | ^~~~~ main.c:146:6: error: conflicting types for 'is_smaller'; have 'BOOL(WORD, int)' {aka 'int(struct Word, int)'} 146 | BOOL is_smaller(WORD tempWORD, int cnt) | ^~~~~~~~~~ main.c:16:14: note: previous declaration of 'is_smaller' with type 'BOOL(WORD, int)' {aka 'int(struct Word, int)'} 16 | BOOL is_smaller(WORD, int); | ^~~~~~~~~~ main.c: In function 'is_smaller': main.c:150:9: error: 'else' without a previous 'if' 150 | else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0) | ^~~~ main.c: At top level: main.c:167:6: error: redefinition of 'output' 167 | void output() | ^~~~~~ main.c:88:6: note: previous definition of 'output' with type 'void()' 88 | void output() | ^~~~~~
s648021867
p00105
C
#include<functional> #include<list> #include<queue> #include<stack> #include<stdio.h> #include<stdlib.h> #include<string.h> class word{ public: char w[31]; std::priority_queue<int> q; }; int main(){ using namespace std; int p,cmp; char str[31]; list<word> wlst; list<word>::iterator it; stack<int> b; word *buf; while(scanf("%s %d",str,&p)!=EOF){ it=wlst.begin(); while(it!=wlst.end()){ cmp=strcmp(it->w,str); if(!cmp){ it->q.push(p); break; }else if(cmp>0){ buf=new word(); strcpy(buf->w,str); buf->q.push(p); wlst.insert(it,*buf); break; } ++it; } if(it==wlst.end()){ buf=new word(); strcpy(buf->w,str); buf->q.push(p); wlst.insert(it,*buf); } } it=wlst.begin(); while(it!=wlst.end()){ printf("%s\n",it->w); while(!(it->q.empty())){ b.push(it->q.top()); it->q.pop(); } while(1){ printf("%d",b.top()); b.pop(); if(b.empty()){ printf("\n"); break; }else{ printf(" "); } } it++; } return 0; }
main.c:1:9: fatal error: functional: No such file or directory 1 | #include<functional> | ^~~~~~~~~~~~ compilation terminated.
s773394284
p00105
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int i,look,first,prev,n,index; int dic[105][2],page[105]; char s[105][35],word[35]; int main(void){ while(scanf("%s %d",s[n],&page[n])!=EOF){ dic[n][0]=n;dic[n][1]=999; look=first;prev=-1; while(look!=n){ index=dic[look][0]; if(strcmp(s[n],s[index])<0 || (strcmp(s[n],s[index])==0 && page[n]<page[index]) ){ dic[n][1]=look; if(prev<0){first=n;} else{dic[prev][1]=n;} break; } else{ if(dic[look][1]>111){ dic[look][1]=n; break; } else{ prev=look; look=dic[look][1]; } } } n++; } i=first; while(i<111){ if(strcmp(word,s[dic[i][0]])!=0){ strcpy(word,s[dic[i][0]]); if(i!=first)printf("\n"); printf("%s\n",word); printf("%d",page[dic[i][0]]); } else{ printf(" %d",page[dic[i][0]]); } i=dic[i][1]; } printf("\n"); return 0; }
main.c:5:25: error: 'index' redeclared as different kind of symbol 5 | int i,look,first,prev,n,index; | ^~~~~ In file included from /usr/include/string.h:462, from main.c:2: /usr/include/strings.h:68:14: note: previous declaration of 'index' with type 'char *(const char *, int)' 68 | extern char *index (const char *__s, int __c) | ^~~~~
s274054931
p00105
C
int main(void){ while(scanf("%s %d",s[n],&page[n])!=EOF){ dic[n][0]=n;dic[n][1]=999; look=first;prev=-1; while(look!=n){ dex=dic[look][0]; if(strcmp(s[n],s[dex])<0 || (strcmp(s[n],s[dex])==0 && page[n]<page[dex]) ){ dic[n][1]=look; if(prev<0){first=n;} else{dic[prev][1]=n;} break; } else{ if(dic[look][1]>111){ dic[look][1]=n; break; } else{ prev=look; look=dic[look][1]; } } } n++; } i=first; while(i<111){ if(strcmp(word,s[dic[i][0]])!=0){ strcpy(word,s[dic[i][0]]); if(i!=first)printf("\n"); printf("%s\n",word); printf("%d",page[dic[i][0]]); } else{ printf(" %d",page[dic[i][0]]); } i=dic[i][1]; } printf("\n"); return 0; }
main.c: In function 'main': main.c:2:15: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | while(scanf("%s %d",s[n],&page[n])!=EOF){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main(void){ main.c:2:15: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | while(scanf("%s %d",s[n],&page[n])!=EOF){ | ^~~~~ main.c:2:15: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:2:29: error: 's' undeclared (first use in this function) 2 | while(scanf("%s %d",s[n],&page[n])!=EOF){ | ^ main.c:2:29: note: each undeclared identifier is reported only once for each function it appears in main.c:2:31: error: 'n' undeclared (first use in this function) 2 | while(scanf("%s %d",s[n],&page[n])!=EOF){ | ^ main.c:2:35: error: 'page' undeclared (first use in this function) 2 | while(scanf("%s %d",s[n],&page[n])!=EOF){ | ^~~~ main.c:2:45: error: 'EOF' undeclared (first use in this function) 2 | while(scanf("%s %d",s[n],&page[n])!=EOF){ | ^~~ main.c:2:45: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:3:17: error: 'dic' undeclared (first use in this function) 3 | dic[n][0]=n;dic[n][1]=999; | ^~~ main.c:5:17: error: 'look' undeclared (first use in this function) 5 | look=first;prev=-1; | ^~~~ main.c:5:22: error: 'first' undeclared (first use in this function) 5 | look=first;prev=-1; | ^~~~~ main.c:5:28: error: 'prev' undeclared (first use in this function) 5 | look=first;prev=-1; | ^~~~ main.c:7:25: error: 'dex' undeclared (first use in this function) 7 | dex=dic[look][0]; | ^~~ main.c:8:28: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] 8 | if(strcmp(s[n],s[dex])<0 || (strcmp(s[n],s[dex])==0 && page[n]<page[dex]) ){ | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'strcmp' +++ |+#include <string.h> 1 | int main(void){ main.c:28:9: error: 'i' undeclared (first use in this function) 28 | i=first; | ^ main.c:30:27: error: 'word' undeclared (first use in this function) 30 | if(strcmp(word,s[dic[i][0]])!=0){ | ^~~~ main.c:31:25: error: implicit declaration of function 'strcpy' [-Wimplicit-function-declaration] 31 | strcpy(word,s[dic[i][0]]); | ^~~~~~ main.c:31:25: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:31:25: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch] main.c:31:25: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:32:37: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 32 | if(i!=first)printf("\n"); | ^~~~~~ main.c:32:37: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:32:37: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:32:37: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:33:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 33 | printf("%s\n",word); | ^~~~~~ main.c:33:25: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:37:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 37 | printf(" %d",page[dic[i][0]]); | ^~~~~~ main.c:37:25: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:43:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 43 | printf("\n"); | ^~~~~~ main.c:43:9: note: include '<stdio.h>' or provide a declaration of 'printf'
s124267984
p00105
C
#include<iostream> #include<algorithm> #include<string> #include<map> #include<vector> using namespace std; string str; int n; map<string, vector<int> > dict; int main(){ while(cin >> str >> n){ dict[str].push_back(n); } map<string, vector<int> >::iterator it = dict.begin(); while(it != dict.end()){ cout << it->first << endl; sort(it->second.begin(), it->second.end()); for(int i = 0;i < it->second.size();i++){ if(i != 0)cout << " "; cout << it->second.at(i); } cout << endl; it++; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s734917024
p00105
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char word[ 31 ]; int cnt, page[ 100 ]; } Data; Data data[ 100 ]; int compare1( const void *a, const void *b ) { return *(int *)a - *(int *)b; } int compare2( const void *a, const void *b ) { return strcmp( (*(Data *)a).word, (*(Data *)b).word ); } int main( void ) { int i, j; char word[ 31 ]; int page, cnt; cnt = 0; while ( scanf( "%s %d", word, &page ) != EOF ) { for ( i = 0; i < cnt && strcmp( word, data[ i ].word ); i++ ) ; if ( i == cnt ) strcpy( data[ cnt++ ].word, word ); data[ i ].page[ data[ i ].cnt++ ] = page; } for ( i = 0; i < cnt; i++ ) qsort( data[ i ].page, data[ i ].cnt, sizeof(int), &compare1 ); qsort( data, cnt, sizeof(Data), &compare2 ); while ( i = 0; i < cnt; i++ ) { puts( data[ i ].word ); for ( j = 0; j < data[ i ].cnt; j++ ) printf( "%d%c", data[ i ].page[ j ], j == data[ i ].cnt - 1 ? '\n' : ' ' ); } return 0; }
main.c: In function 'main': main.c:37:22: error: expected ')' before ';' token 37 | while ( i = 0; i < cnt; i++ ) { | ~ ^ | )
s826722554
p00105
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s327472819
p00105
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s130257117
p00105
C++
l
a.cc:1:1: error: 'l' does not name a type 1 | l | ^
s508533835
p00105
C++
#include <iostream> #include <string> #include <map> #include <vector> using namespace std; int main() { map<string, vector<int> > index; vector<string> strv; string s; int p; while (cin >> s >> p){ if (index.find(s) == index.end()){ strv.push_back(s); } index[s].push_back(p); } sort(strv.begin(), strv.end()); for (int i = 0; i < strv.size(); i++){ sort(index[strv[i]].begin(), index[strv[i]].end()); cout << strv[i] << endl; cout << index[strv[i]][0]; for (int j = 1; j < index[strv[i]].size(); j++){ cout << ' ' << index[strv[i]][j]; } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:21:9: error: 'sort' was not declared in this scope; did you mean 'short'? 21 | sort(strv.begin(), strv.end()); | ^~~~ | short
s249281978
p00105
C++
#include<cstdio> #include<iostream> #include<vector> #include<map> using namespace std; int main() { map<string, vector<int> > D; string w; int n; while(cin >> w >> n) { D[w].push_back(n); } map<string, vector<int> >::iterator it = D.begin(); for(; it != D.end(); it++) { cout << it->first << endl; int size = it->second.size(); sort(it->second.begin(),it->second.end()); for(int i = 0; i < size - 1; i++){ cout << it->second[i] << " "; } cout << it->second[size-1] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:17:17: error: 'sort' was not declared in this scope; did you mean 'short'? 17 | sort(it->second.begin(),it->second.end()); | ^~~~ | short
s831264904
p00105
C++
/* 0105:book Index */ #include <iostream> #include <vector> #include <utility> #include <string> using namespace std; typedef pair<string, int> P_SI; int main(void) { string memstr = " "; vector<P_SI> words; while(1) { string buf_s; int buf_i; cin >> buf_s >> buf_i; if(cin.eof()) { break; } words.push_back( P_SI(buf_s, buf_i) ); } sort( words.begin(), words.end() ); vector<P_SI>::iterator it = words.begin(); bool isFirst = true; while( it != words.end() ) { string buf_s = (*it).first; int buf_i = (*it).second; if(buf_s != memstr) { if(it != words.begin()) { cout << endl; } cout << buf_s << endl; memstr = buf_s; isFirst = true; } if(isFirst) { cout << buf_i; isFirst = false; } else { cout << ' ' << buf_i; } it++; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:25:9: error: 'sort' was not declared in this scope; did you mean 'short'? 25 | sort( words.begin(), words.end() ); | ^~~~ | short
s303722982
p00105
C++
//include //------------------------------------------ #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <fstream> #include <conio.h> using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //math //------------------------------------------- template<class T> inline T sqr(T x) {return x*x;} //typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef pair<long, long> PLL; typedef long long LL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) int main(){ string str; vector<pair<string,int>>sp; int cnt=0; while(cnt==0||kbhit()){ getline(cin,str); string t1="",t2=""; int i; for(i=0;str[i]!=' ';i++){ t1+=str[i]; } i++; for(;i<SZ(str);i++){ t2+=str[i]; } int num=toInt(t2); sp.PB(MP(t1,num)); cnt++; } bool c=false; SORT(sp); REP(i,SZ(sp)){ if(!c)cout<<sp[i].first<<endl; if(i!=SZ(sp)-1&&sp[i].first==sp[i+1].first){ cout<<sp[i].second<<" "; c=true; }else{ c=false; cout<<sp[i].second<<endl; } } return 0; }
a.cc:25:10: fatal error: conio.h: No such file or directory 25 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s162873383
p00105
C++
//include //------------------------------------------ #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <fstream> #include <conio.h> using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //math //------------------------------------------- template<class T> inline T sqr(T x) {return x*x;} //typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef pair<long, long> PLL; typedef long long LL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) int main(){ string str; vector<pair<string,int>>sp; int cnt=0; while(cnt==0||kbhit()){ getline(cin,str); string t1="",t2=""; int i; for(i=0;str[i]!=' ';i++){ t1+=str[i]; } i++; for(;i<SZ(str);i++){ t2+=str[i]; } int num=toInt(t2); sp.PB(MP(t1,num)); cnt++; } bool c=false; SORT(sp); REP(i,SZ(sp)){ if(!c)cout<<sp[i].first<<endl; if(i!=SZ(sp)-1&&sp[i].first==sp[i+1].first){ cout<<sp[i].second<<" "; c=true; }else{ c=false; cout<<sp[i].second<<endl; } } return 0; }
a.cc:25:10: fatal error: conio.h: No such file or directory 25 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s591600657
p00105
C++
//include //------------------------------------------ #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <fstream> #include <conio.h> using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //math //------------------------------------------- template<class T> inline T sqr(T x) {return x*x;} //typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef pair<long, long> PLL; typedef long long LL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) int main(){ string str; vector<pair<string,int>>sp; int num; while(cin>>str>>num){ sp.PB(MP(str,num)); } bool c=false; SORT(sp); REP(i,SZ(sp)){ if(!c)cout<<sp[i].first<<endl; if(i!=SZ(sp)-1&&sp[i].first==sp[i+1].first){ cout<<sp[i].second<<" "; c=true; }else{ c=false; cout<<sp[i].second<<endl; } } return 0; }
a.cc:25:10: fatal error: conio.h: No such file or directory 25 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s400052737
p00105
C++
//Name: Book Index //Level: 2 //Category: やるだけ //Note: /** * mapを使って語句とページ番号を管理すると、語句は勝手に昇順に並ぶ。 * ページ番号は出力時にソートする。 * * オーダーは O(N|S| log N)。 * ただしNは語句の個数、|S|は語句の最大長。 */ #include <iostream> #include <string> #include <vector> #include <map> using namespace std; bool solve() { string word; int page; map<string,vector<int>> dict; while(cin >> word >> page) { dict[word].push_back(page); } for(auto &e : dict) { cout << e.first << endl; sort(begin(e.second), end(e.second)); for(int i = 0; i < (int)e.second.size(); ++i) { if(i > 0) cout << ' '; cout << e.second[i]; } cout << endl; } return false; } int main() { cin.tie(0); ios::sync_with_stdio(0); while(solve()) ; return 0; }
a.cc: In function 'bool solve()': a.cc:29:9: error: 'sort' was not declared in this scope; did you mean 'short'? 29 | sort(begin(e.second), end(e.second)); | ^~~~ | short
s522459445
p00105
C++
??£??£??£???
a.cc:1:3: error: extended character £ is not valid in an identifier 1 | ??£??£??£??? | ^ a.cc:1:6: error: extended character £ is not valid in an identifier 1 | ??£??£??£??? | ^ a.cc:1:9: error: extended character £ is not valid in an identifier 1 | ??£??£??£??? | ^ a.cc:1:1: error: expected unqualified-id before '?' token 1 | ??£??£??£??? | ^
s019729048
p00105
C++
#include <iostream> #include <cstdio> #include <cstring> using namespace std; #define SWAP(A, B) {int tmp = (B); (B) = (A); (A) = (tmp);} int main() { char word[100][31]; int pagenum[100]; int sortnum[100]; int count; for (int i = 0; i < 100; i++) sortnum[i] = i; for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); for (int i = 0; i < count; i++) { for (int j = 0; j < count - i - 1; j++) { if (strcmp(word[sortnum[j]], word[sortnum[j+1]]) > 0) SWAP(sortnum[j], sortnum[j+1]); } } for (int i = 0; i < count; i++) { if (strcmp(word[sortnum[i]], word[sortnum[i+1]]) == 0) { int j, flag = 0; for (j = i ; j < count - 1 && strcmp(word[sortnum[j]], word[sortnum[j+1]]) == 0 ; j++) { if (pagenum[sortnum[j]] > pagenum[sortnum[j+1]]) { SWAP(sortnum[j], sortnum[j+1]); flag = 1; } } if (flag) i--; else i = j; } } for (int i = 0; i < count; i++) { cout << word[sortnum[i]] << endl; if (strcmp(word[sortnum[i]], word[sortnum[i+1]]) == 0) { for (; i < count && strcmp(word[sortnum[i]], word[sortnum[i+1]]) == 0; i++) { cout << pagenum[sortnum[i]] << ' '; } } cout << pagenum[sortnum[i]] << endl; } system("pause"); return 0; }
a.cc: In function 'int main()': a.cc:17:62: error: no match for 'operator!=' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'long int') 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^ a.cc:17:62: note: candidate: 'operator!=(int, long int)' (built-in) a.cc:17:62: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: In file included from /usr/include/strings.h:23, from /usr/include/string.h:462, from /usr/include/c++/14/cstring:43, from a.cc:3: a.cc:17:65: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:17:65: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::allocator<_CharT>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:17:65: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:17:65: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:17:65: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:17:65: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:17:65: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:17:65: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ /usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:17:65: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ /usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed: a.cc:17:65: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long int' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed: a.cc:17:65: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3847 | operator!=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed: a.cc:17:65: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 17 | for (count = 0; cin >> word[count] >> pagenum[count] != NULL; count++); | ^~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed: a.cc:17:65: note: 'std::
s937936837
p00105
C++
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int temp; int k,page; int i,flag=0; int j,count=0; string word; string index[1000]; int num[1000][100]; int appe[1000][2]; memset(num,0,sizeof(num)); memset(appe,0,sizeof(appe)); for(i=0;i<1000;i++) { index[i]=""; } while(cin>>word>>page) { for(j=0;j<flag;j++) { if(word.compare(index[j])!=0) { count++; } else { for(k=0;k<100;k++) { if(num[j][k]==0) { num[j][k]=page; break; } } } } if(count==flag) { index[flag]=word; num[flag][0]=page; appe[flag][0]=flag; appe[flag][1]=word.at(0)-'a'; } count=0; flag++; } for(i=0;i<flag;i++) { for(j=0;j<flag-1-i;j++) { if(appe[j][1]>appe[j+1][1]) { temp=appe[j][1]; appe[j][1]=appe[j+1][1]; appe[j+1][1]=temp; temp=appe[j][0]; appe[j][0]=appe[j+1][0]; appe[j+1][0]=temp; } } } for(i=0;i<flag;i++) { j=0; cout<<index[appe[i][0]]<<endl; while(num[appe[i][0]][j]!=0) { cout<<num[appe[i][0]][j]<<" "; j++; } cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:9: error: 'memset' was not declared in this scope 16 | memset(num,0,sizeof(num)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <vector> +++ |+#include <cstring> 4 | using namespace std;
s508604118
p00105
C++
#include <algorithm> #include <cmath> #include <climits> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <cassert> #include <functional> using namespace std; #define LOG(...) printf(__VA_ARGS__) //#define LOG(...) #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define REP(i,n) for(int i=0;i<(int)(n);++i) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define RSORT(c) sort((c).rbegin(),(c).rend()) #define CLR(a) memset((a), 0 ,sizeof(a)) typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vb> vvb; typedef vector<vi> vvi; typedef vector<vll> vvll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 }; struct index{ string s; int p; bool operator<(const index &right) const{ return right.s != s ? right.s > s :right.p > p; } }; int main() { vector<index> book; string s; int n; while (cin >> s >> n) book.push_back({ s, n }); SORT(book); s = ""; REP(i, book.size()){ if (book[i].s != s){ if (i != 0)cout << endl; cout << book[i].s << endl; cout << book[i].p; } else{ cout << ' ' << book[i].p; } s = book[i].s; } cout << endl; }
a.cc: In function 'int main()': a.cc:54:21: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector' 54 | vector<index> book; | ^ a.cc:54:21: note: expected a type, got 'index' a.cc:54:21: error: template argument 2 is invalid a.cc:58:22: error: request for member 'push_back' in 'book', which is of non-class type 'int' 58 | book.push_back({ s, n }); | ^~~~~~~~~ a.cc:29:26: error: request for member 'begin' in 'book', which is of non-class type 'int' 29 | #define SORT(c) sort((c).begin(),(c).end()) | ^~~~~ a.cc:59:9: note: in expansion of macro 'SORT' 59 | SORT(book); | ^~~~ a.cc:29:38: error: request for member 'end' in 'book', which is of non-class type 'int' 29 | #define SORT(c) sort((c).begin(),(c).end()) | ^~~ a.cc:59:9: note: in expansion of macro 'SORT' 59 | SORT(book); | ^~~~ a.cc:61:21: error: request for member 'size' in 'book', which is of non-class type 'int' 61 | REP(i, book.size()){ | ^~~~ a.cc:25:38: note: in definition of macro 'REP' 25 | #define REP(i,n) for(int i=0;i<(int)(n);++i) | ^ a.cc:62:25: error: invalid types 'int[int]' for array subscript 62 | if (book[i].s != s){ | ^ a.cc:64:37: error: invalid types 'int[int]' for array subscript 64 | cout << book[i].s << endl; | ^ a.cc:65:37: error: invalid types 'int[int]' for array subscript 65 | cout << book[i].p; | ^ a.cc:68:44: error: invalid types 'int[int]' for array subscript 68 | cout << ' ' << book[i].p; | ^ a.cc:70:25: error: invalid types 'int[int]' for array subscript 70 | s = book[i].s; | ^
s883132711
p00105
C++
#include <algorithm> #include <cmath> #include <climits> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <cassert> #include <functional> using namespace std; #define LOG(...) printf(__VA_ARGS__) //#define LOG(...) #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define REP(i,n) for(int i=0;i<(int)(n);++i) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define RSORT(c) sort((c).rbegin(),(c).rend()) #define CLR(a) memset((a), 0 ,sizeof(a)) typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vb> vvb; typedef vector<vi> vvi; typedef vector<vll> vvll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 }; struct index{ string s; int p; bool operator<(const index &right) const{ return right.s != s ? right.s > s :right.p > p; } }; int main() { vector<index> book; string s; int n; while (cin >> s >> n) book.push_back({ s, n }); SORT(book); s = ""; REP(i, book.size()){ if (book[i].s != s){ if (i != 0)cout << endl; cout << book[i].s << endl; cout << book[i].p; } else{ cout << ' ' << book[i].p; } s = book[i].s; } cout << endl; }
a.cc: In function 'int main()': a.cc:54:21: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector' 54 | vector<index> book; | ^ a.cc:54:21: note: expected a type, got 'index' a.cc:54:21: error: template argument 2 is invalid a.cc:58:22: error: request for member 'push_back' in 'book', which is of non-class type 'int' 58 | book.push_back({ s, n }); | ^~~~~~~~~ a.cc:29:26: error: request for member 'begin' in 'book', which is of non-class type 'int' 29 | #define SORT(c) sort((c).begin(),(c).end()) | ^~~~~ a.cc:59:9: note: in expansion of macro 'SORT' 59 | SORT(book); | ^~~~ a.cc:29:38: error: request for member 'end' in 'book', which is of non-class type 'int' 29 | #define SORT(c) sort((c).begin(),(c).end()) | ^~~ a.cc:59:9: note: in expansion of macro 'SORT' 59 | SORT(book); | ^~~~ a.cc:61:21: error: request for member 'size' in 'book', which is of non-class type 'int' 61 | REP(i, book.size()){ | ^~~~ a.cc:25:38: note: in definition of macro 'REP' 25 | #define REP(i,n) for(int i=0;i<(int)(n);++i) | ^ a.cc:62:25: error: invalid types 'int[int]' for array subscript 62 | if (book[i].s != s){ | ^ a.cc:64:37: error: invalid types 'int[int]' for array subscript 64 | cout << book[i].s << endl; | ^ a.cc:65:37: error: invalid types 'int[int]' for array subscript 65 | cout << book[i].p; | ^ a.cc:68:44: error: invalid types 'int[int]' for array subscript 68 | cout << ' ' << book[i].p; | ^ a.cc:70:25: error: invalid types 'int[int]' for array subscript 70 | s = book[i].s; | ^
s438189151
p00105
C++
#include <algorithm> #include <cmath> #include <climits> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <cassert> #include <functional> using namespace std; #define LOG(...) printf(__VA_ARGS__) //#define LOG(...) #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define REP(i,n) for(int i=0;i<(int)(n);++i) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define RSORT(c) sort((c).rbegin(),(c).rend()) #define CLR(a) memset((a), 0 ,sizeof(a)) typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vb> vvb; typedef vector<vi> vvi; typedef vector<vll> vvll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 }; struct index{ string s; int p; bool operator<(const index &right) const{ return right.s != s ? right.s > s :right.p > p; } }; int main() { vector<index> book; string s; int n; while (cin >> s >> n) book.push_back({ s, n }); SORT(book); s = ""; REP(i, book.size()){ if (book[i].s != s){ if (i != 0)cout << endl; cout << book[i].s << endl; cout << book[i].p; } else{ cout << ' ' << book[i].p; } s = book[i].s; } cout << endl; }
a.cc: In function 'int main()': a.cc:54:21: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector' 54 | vector<index> book; | ^ a.cc:54:21: note: expected a type, got 'index' a.cc:54:21: error: template argument 2 is invalid a.cc:58:22: error: request for member 'push_back' in 'book', which is of non-class type 'int' 58 | book.push_back({ s, n }); | ^~~~~~~~~ a.cc:29:26: error: request for member 'begin' in 'book', which is of non-class type 'int' 29 | #define SORT(c) sort((c).begin(),(c).end()) | ^~~~~ a.cc:59:9: note: in expansion of macro 'SORT' 59 | SORT(book); | ^~~~ a.cc:29:38: error: request for member 'end' in 'book', which is of non-class type 'int' 29 | #define SORT(c) sort((c).begin(),(c).end()) | ^~~ a.cc:59:9: note: in expansion of macro 'SORT' 59 | SORT(book); | ^~~~ a.cc:61:21: error: request for member 'size' in 'book', which is of non-class type 'int' 61 | REP(i, book.size()){ | ^~~~ a.cc:25:38: note: in definition of macro 'REP' 25 | #define REP(i,n) for(int i=0;i<(int)(n);++i) | ^ a.cc:62:25: error: invalid types 'int[int]' for array subscript 62 | if (book[i].s != s){ | ^ a.cc:64:37: error: invalid types 'int[int]' for array subscript 64 | cout << book[i].s << endl; | ^ a.cc:65:37: error: invalid types 'int[int]' for array subscript 65 | cout << book[i].p; | ^ a.cc:68:44: error: invalid types 'int[int]' for array subscript 68 | cout << ' ' << book[i].p; | ^ a.cc:70:25: error: invalid types 'int[int]' for array subscript 70 | s = book[i].s; | ^
s216011510
p00105
C++
#include<cstdio> #include<map> #include<vector> #include<string> #include<algorithm> using namespace std; int main(void) { map < string, vector<int> > index; char cbuf[31]; int ibuf; while (scanf_s("%s %d", cbuf, 31, &ibuf) != EOF) { index[cbuf].push_back(ibuf); } for (auto &elem : index) { sort(elem.second.begin(), elem.second.end()); printf_s("%s\n", elem.first.c_str()); for (auto &vecElem : elem.second) { printf_s("%d ", vecElem); } printf_s("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:14:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 14 | while (scanf_s("%s %d", cbuf, 31, &ibuf) != EOF) | ^~~~~~~ | scanf a.cc:22:17: error: 'printf_s' was not declared in this scope; did you mean 'printf'? 22 | printf_s("%s\n", elem.first.c_str()); | ^~~~~~~~ | printf
s723783355
p00105
C++
#include<stdio.h> #include<map> #include<vector> #include<string> #include<algorithm> using namespace std; int main(void) { map < string, vector<int> > index; char cbuf[31]; int ibuf; while (scanf_s("%s %d", cbuf, 31, &ibuf) != EOF) { index[cbuf].push_back(ibuf); } for (auto &elem : index) { sort(elem.second.begin(), elem.second.end()); printf_s("%s\n", elem.first.c_str()); for (auto &vecElem : elem.second) { printf_s("%d ", vecElem); } printf_s("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:14:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 14 | while (scanf_s("%s %d", cbuf, 31, &ibuf) != EOF) | ^~~~~~~ | scanf a.cc:22:17: error: 'printf_s' was not declared in this scope; did you mean 'printf'? 22 | printf_s("%s\n", elem.first.c_str()); | ^~~~~~~~ | printf
s016181878
p00105
C++
import java.util.*; import java.io.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>(); ArrayList<Integer> page ; while (sc.hasNext() ) { String key = sc.next(); int pageIn = sc.nextInt(); if ( !map.containsKey(key) ) { map.put(key, new ArrayList<Integer>() ); } map.get(key).add(pageIn); } Iterator it = map.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); ArrayList <Integer> list = map.get(key); Collections.sort(list); System.out.println(key); for(int i = 0; i < list.size(); i++){ if(i == 0){ System.out.print(list.get(i)); }else{ System.out.print(" " + list.get(i)); } } System.out.println(); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.io.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:15: error: expected ':' before 'static' 4 | public static void main(String[] args) { | ^~~~~~~ | : a.cc:4:33: error: 'String' has not been declared 4 | public static void main(String[] args) { | ^~~~~~ a.cc:4:42: error: expected ',' or '...' before 'args' 4 | public static void main(String[] args) { | ^~~~ a.cc:38:2: error: expected ';' after class definition 38 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:5:17: error: 'Scanner' was not declared in this scope 5 | Scanner sc = new Scanner(System.in); | ^~~~~~~ a.cc:6:17: error: 'Map' was not declared in this scope 6 | Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>(); | ^~~ a.cc:6:21: error: 'String' was not declared in this scope 6 | Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>(); | ^~~~~~ a.cc:6:29: error: 'ArrayList' was not declared in this scope 6 | Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>(); | ^~~~~~~~~ a.cc:6:39: error: 'Integer' was not declared in this scope 6 | Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>(); | ^~~~~~~ a.cc:6:49: error: 'map' was not declared in this scope 6 | Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>(); | ^~~ a.cc:6:59: error: 'TreeMap' does not name a type 6 | Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>(); | ^~~~~~~ a.cc:6:95: error: expected primary-expression before ')' token 6 | Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>(); | ^ a.cc:7:36: error: 'page' was not declared in this scope 7 | ArrayList<Integer> page ; | ^~~~ a.cc:9:24: error: 'sc' was not declared in this scope 9 | while (sc.hasNext() ) { | ^~ a.cc:10:32: error: expected ';' before 'key' 10 | String key = sc.next(); | ^~~ a.cc:12:47: error: 'key' was not declared in this scope 12 | if ( !map.containsKey(key) ) { | ^~~ a.cc:13:50: error: 'ArrayList' does not name a type 13 | map.put(key, new ArrayList<Integer>() ); | ^~~~~~~~~ a.cc:13:69: error: expected primary-expression before ')' token 13 | map.put(key, new ArrayList<Integer>() ); | ^ a.cc:15:33: error: 'key' was not declared in this scope 15 | map.get(key).add(pageIn); | ^~~ a.cc:19:17: error: 'Iterator' was not declared in this scope 19 | Iterator it = map.keySet().iterator(); | ^~~~~~~~ a.cc:20:24: error: 'it' was not declared in this scope; did you mean 'int'? 20 | while (it.hasNext()) { | ^~ | int a.cc:21:32: error: expected ';' before 'key' 21 | String key = (String) it.next(); | ^~~ a.cc:22:45: error: 'list' was not declared in this scope 22 | ArrayList <Integer> list = map.get(key); | ^~~~ a.cc:22:60: error: 'key' was not declared in this scope 22 | ArrayList <Integer> list = map.get(key); | ^~~ a.cc:23:25: error: 'Collections' was not declared in this scope 23 | Collections.sort(list); | ^~~~~~~~~~~ a.cc:24:25: error: 'System' was not declared in this scope 24 | System.out.println(key); | ^~~~~~
s689816826
p00105
C++
#include <bits/stdc++.h> using namespace std; pair<string,int> a[100]; int main(){ int t=0,g; string f,b; while(cin>>a[t].first>>a[t].second)t++; sort(a,a+t); b=a[0].first cout<<b<<endl<<a[0].second; for(int i=1;i<t;i++){ bool n=0; f=a[i].first,g=a[i].second; if(i)if(f==b)n=1; if(n)cout<<" "<<g; else cout<<endl<<f<<endl<<g; b=f; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:21: error: expected ';' before 'cout' 9 | b=a[0].first | ^ | ; 10 | cout<<b<<endl<<a[0].second; | ~~~~
s382557301
p00105
C++
#include <bits/stdc++.h>using namespace std;pair<string,int> a[100];int main(){int t=0,g,i;string f,b;while(cin>>a[t].first>>a[t].second)t++;sort(a,a+t);b=a[0].first;cout<<b<<endl<<a[0].second;for(i=1;i<t;i++){bool n=0;f=a[i].first,g=a[i].second;if(i)if(f==b)n=1;if(n)cout<<" "<<g;else cout<<endl<<f<<endl<<g;b=f;}cout<<endl;return 0;}
a.cc:1:31: warning: extra tokens at end of #include directive 1 | #include <bits/stdc++.h>using namespace std;pair<string,int> a[100];int main(){int t=0,g,i;string f,b;while(cin>>a[t].first>>a[t].second)t++;sort(a,a+t);b=a[0].first;cout<<b<<endl<<a[0].second;for(i=1;i<t;i++){bool n=0;f=a[i].first,g=a[i].second;if(i)if(f==b)n=1;if(n)cout<<" "<<g;else cout<<endl<<f<<endl<<g;b=f;}cout<<endl;return 0;} | ^~~~~~~~~ a.cc:1:10: fatal error: bits/stdc++.h>usin: No such file or directory 1 | #include <bits/stdc++.h>using namespace std;pair<string,int> a[100];int main(){int t=0,g,i;string f,b;while(cin>>a[t].first>>a[t].second)t++;sort(a,a+t);b=a[0].first;cout<<b<<endl<<a[0].second;for(i=1;i<t;i++){bool n=0;f=a[i].first,g=a[i].second;if(i)if(f==b)n=1;if(n)cout<<" "<<g;else cout<<endl<<f<<endl<<g;b=f;}cout<<endl;return 0;} | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s843207697
p00105
C++
#include <bits/stdc++.h> using namespace std;pair<string,int> a[];int main(){int t=0,g,i;while(cin>>a[t].first>>a[t].second)t++;sort(a,a+t);string f,b=a[0].first;cout<<b<<endl<<a[0].second;for(i=1;i<t;i++){bool n=0;f=a[i].first,g=a[i].second;if(f==b)n=1;if(n)cout<<" "<<g;else cout<<endl<<f<<endl<<g;b=f;}cout<<endl;return 0;}
a.cc:2:38: error: array size missing in 'a' 2 | using namespace std;pair<string,int> a[];int main(){int t=0,g,i;while(cin>>a[t].first>>a[t].second)t++;sort(a,a+t);string f,b=a[0].first;cout<<b<<endl<<a[0].second;for(i=1;i<t;i++){bool n=0;f=a[i].first,g=a[i].second;if(f==b)n=1;if(n)cout<<" "<<g;else cout<<endl<<f<<endl<<g;b=f;}cout<<endl;return 0;} | ^
s412085276
p00105
C++
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main(int argc, char const *argv[]){ vector<int> pages; map<string, vector<int> > books; string name; int page; while (cin>>name>>page){ auto it = books.find(name); if (it != books.end()){ books[name].push_back(page); } else{ vector<int> pages = {page}; books.insert(make_pair(name, pages)); } } for (auto& book : books){ cout<<book.first<<endl; sort(book.second.begin(), book.second.end()); for (const auto& page : book.second){ cout<<page<<" "; } cout<<'\n'; } return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:28:9: error: 'sort' was not declared in this scope; did you mean 'short'? 28 | sort(book.second.begin(), book.second.end()); | ^~~~ | short
s074635298
p00105
C++
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main(int argc, char const *argv[]){ vector<int> pages; map<string, vector<int> > books; string name; int page; while (cin>>name>>page){ auto it = books.find(name); if (it != books.end()){ books[name].push_back(page); } else{ vector<int> pages = {page}; books.insert(make_pair(name, pages)); } } for (auto& book : books){ cout<<book.first<<endl; sort(book.second.begin(), book.second.end()); for (const auto& page : book.second){ cout<<page<<" "; } cout<<'\n'; } return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:28:9: error: 'sort' was not declared in this scope; did you mean 'short'? 28 | sort(book.second.begin(), book.second.end()); | ^~~~ | short
s281332126
p00105
C++
#include <bits/stdc++.h> using namespace std; int main(){ map<string,vector<int> >A; string s; int n; while(cin>>s>>n){ A[s].push_back(n); } map<string,vector<int> >::iterator t=A.begin(); while(t!=A.end()){ cout<<t->first<<endl; sort(t->second.begin(),t->second.end()); for(int i=0;i<size-1i++){ if(i)cout<<' '<<t->second[i]; else cout<<t->second[i]; } cout<<endl; } }
a.cc: In function 'int main()': a.cc:14:26: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 14 | for(int i=0;i<size-1i++){ | ~~^~ a.cc:14:28: error: expected ';' before ')' token 14 | for(int i=0;i<size-1i++){ | ^ | ;
s717971707
p00105
C++
#include <bits/stdc++.h> using namespace std; int main(){ map<string,vector<int> >A; string s; int n; while(cin>>s>>n){ A[s].push_back(n); } map<string,vector<int> >::iterator t=A.begin(); while(t!=A.end()){ cout<<t->first<<endl; sort(t->second.begin(),t->second.end()); for(int i=0;i<SIZE-1i++){ if(i)cout<<' '<<t->second[i]; else cout<<t->second[i]; } cout<<endl; } }
a.cc: In function 'int main()': a.cc:14:19: error: 'SIZE' was not declared in this scope 14 | for(int i=0;i<SIZE-1i++){ | ^~~~ a.cc:14:26: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 14 | for(int i=0;i<SIZE-1i++){ | ~~^~ a.cc:14:28: error: expected ';' before ')' token 14 | for(int i=0;i<SIZE-1i++){ | ^ | ;
s779555671
p00105
C++
#include <bits/stdc++.h> using namespace std; int main(){ map<string,vector<int> >A; string s; int n; while(cin>>s>>n){ A[s].push_back(n); } map<string,vector<int> >::iterator t=A.begin(); while(t!=A.end()){ cout<<t->first<<endl; sort(t->second.begin(),t->second.end()); for(int i=0;i<t->second.size()++){ if(i)cout<<' '<<t->second[i]; else cout<<t->second[i]; } cout<<endl; } }
a.cc: In function 'int main()': a.cc:14:33: error: lvalue required as increment operand 14 | for(int i=0;i<t->second.size()++){ | ~~~~~~~~~~~~~~^~ a.cc:14:37: error: expected ';' before ')' token 14 | for(int i=0;i<t->second.size()++){ | ^ | ;
s365917400
p00105
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for( int i = 0; i < n; i++ ) #define dump(x) cerr << #x << " = " << (x) << endl; #define INF 2000000000 #define mod 1000000007 #define INF2 1000000000000000000 vector<pair<string,int>> str(100000); int main(void) { cin.tie(0); ios::sync_with_stdio(false); int count = 0; int c_n = 0; while (cin >> str[count].first) { cin >> str[count].second; count++; } sort(str.begin(), str.begin() + count); cout << str[0].first << endl; cout << str[0].second; for (int i = 1; i < count; i++) { if (str[i].first != str[i-1].first) { cout << endl << str[i].first << endl; cout << str[i].second; } else { cout << " " << str[i].secosnd; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:29:35: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'secosnd'; did you mean 'second'? 29 | cout << " " << str[i].secosnd; | ^~~~~~~ | second
s372356996
p00105
C++
#include<vector> #include<map> #include<iostream> #include<algorithm> using namespace std; int main(){ map< string , vector<int> > mp; string str; int num; while( cin>>str>>num ){ mp[ str ].push_back( num ); } //for( pair<string,vector<int> > p : mp){ string name=p.first; vector<int> v=p.second; sort(v.begin(),v.end()); cout<<name<<endl; for(int i=0;i<(int)v.size();i++){ if(i>0)cout<<' '; cout<<v[i]; } cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:18:17: error: 'p' was not declared in this scope; did you mean 'mp'? 18 | string name=p.first; | ^ | mp a.cc: At global scope: a.cc:31:3: error: expected unqualified-id before 'return' 31 | return 0; | ^~~~~~ a.cc:32:1: error: expected declaration before '}' token 32 | } | ^
s585431501
p00105
C++
#include <iostream> #include <string> #include <map> #include <set> using namespace std; class data{ public: string words; int page; bool operator < (const data& s)const{ if(words < s.words) return true; else if(words > s.words) return false; else{ if(page < s.page) return true; else return false; } } }; int main(){ int i=0; data in[1000]; while(1){ in[i].words=""; char c; if(scanf("%c", &c)==EOF) break; in[i].words+=c; for(int j=1;;j++){ scanf("%c", &c); if(c==' ') break; in[i].words+=c; } cin >> in[i].page; getchar(); i++; } sort(in,in+i); cout << in[0].words << endl << in[0].page; for(int j=1;j<i;j++){ if(in[j-1].words != in[j].words){ cout << endl; cout << in[j].words << endl << in[j].page; } else{ cout << ' ' << in[j].page; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:3: error: reference to 'data' is ambiguous 21 | data in[1000]; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:6:7: note: 'class data' 6 | class data{ | ^~~~ a.cc:23:5: error: 'in' was not declared in this scope; did you mean 'i'? 23 | in[i].words=""; | ^~ | i a.cc:37:8: error: 'in' was not declared in this scope; did you mean 'i'? 37 | sort(in,in+i); | ^~ | i a.cc:37:3: error: 'sort' was not declared in this scope; did you mean 'short'? 37 | sort(in,in+i); | ^~~~ | short
s257802891
p00105
C++
#include <iostream> #include <string> using namespace std; class data{ public: string words; int page; bool operator < (const data& s)const{ if(words < s.words) return true; else if(words > s.words) return false; else{ if(page < s.page) return true; else return false; } } }; int main(){ int i=0; data in[1000]; while(1){ in[i].words=""; char c; if(scanf("%c", &c)==EOF) break; in[i].words+=c; for(int j=1;;j++){ scanf("%c", &c); if(c==' ') break; in[i].words+=c; } cin >> in[i].page; getchar(); i++; } sort(in,in+i); cout << in[0].words << endl << in[0].page; for(int j=1;j<i;j++){ if(in[j-1].words != in[j].words){ cout << endl; cout << in[j].words << endl << in[j].page; } else{ cout << ' ' << in[j].page; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:3: error: reference to 'data' is ambiguous 19 | data in[1000]; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:4:7: note: 'class data' 4 | class data{ | ^~~~ a.cc:21:5: error: 'in' was not declared in this scope; did you mean 'i'? 21 | in[i].words=""; | ^~ | i a.cc:35:8: error: 'in' was not declared in this scope; did you mean 'i'? 35 | sort(in,in+i); | ^~ | i a.cc:35:3: error: 'sort' was not declared in this scope; did you mean 'short'? 35 | sort(in,in+i); | ^~~~ | short
s354410787
p00105
C++
#include <iostream> #include <string> using namespace std; class data{ public: string words; int page; bool operator < (const data& s)const{ if(words < s.words) return true; else if(words > s.words) return false; else{ if(page < s.page) return true; else return false; } } }; int main(){ int i=0; data in[1000]; while(1){ in[i].words=""; char c; if(scanf("%c", &c)==EOF) break; in[i].words+=c; for(int j=1;;j++){ scanf("%c", &c); if(c==' ') break; in[i].words+=c; } cin >> in[i].page; getchar(); i++; } sort(in,in+i); cout << in[0].words << endl << in[0].page; for(int j=1;j<i;j++){ if(in[j-1].words != in[j].words){ cout << endl; cout << in[j].words << endl << in[j].page; } else{ cout << ' ' << in[j].page; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:3: error: reference to 'data' is ambiguous 19 | data in[1000]; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:4:7: note: 'class data' 4 | class data{ | ^~~~ a.cc:21:5: error: 'in' was not declared in this scope; did you mean 'i'? 21 | in[i].words=""; | ^~ | i a.cc:35:8: error: 'in' was not declared in this scope; did you mean 'i'? 35 | sort(in,in+i); | ^~ | i a.cc:35:3: error: 'sort' was not declared in this scope; did you mean 'short'? 35 | sort(in,in+i); | ^~~~ | short
s319206973
p00105
C++
#include <iostream> #include <string> using namespace std; class data{ public: string words; int page; bool operator < (const data&s)const{ if(words < s.words) return true; else if(words > s.words) return false; else{ if(page < s.page) return true; else return false; } } }; int main(){ int i=0; data in[1000]; while(1){ in[i].words=""; char c; if(scanf("%c", &c)==EOF) break; in[i].words+=c; for(int j=1;;j++){ scanf("%c", &c); if(c==' ') break; in[i].words+=c; } cin >> in[i].page; getchar(); i++; } sort(in,in+i); cout << in[0].words << endl << in[0].page; for(int j=1;j<i;j++){ if(in[j-1].words != in[j].words){ cout << endl; cout << in[j].words << endl << in[j].page; } else{ cout << ' ' << in[j].page; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:3: error: reference to 'data' is ambiguous 19 | data in[1000]; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:4:7: note: 'class data' 4 | class data{ | ^~~~ a.cc:21:5: error: 'in' was not declared in this scope; did you mean 'i'? 21 | in[i].words=""; | ^~ | i a.cc:35:8: error: 'in' was not declared in this scope; did you mean 'i'? 35 | sort(in,in+i); | ^~ | i a.cc:35:3: error: 'sort' was not declared in this scope; did you mean 'short'? 35 | sort(in,in+i); | ^~~~ | short
s395065721
p00105
C++
#include <iostream> #include <string> using namespace std; class data{ public: string words; int page; bool operator < (const data&s)const{ if(words < s.words) return true; else if(words > s.words) return false; else{ if(page < s.page) return true; else return false; } } }; int main(){ int i=0; data in[1000]; while(cin >> in[i].words){ cin >> in[i].page; i++; } sort(in,in+i); cout << in[0].words << endl << in[0].page; for(int j=1;j<i;j++){ if(in[j-1].words != in[j].words){ cout << endl; cout << in[j].words << endl << in[j].page; } else{ cout << ' ' << in[j].page; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:3: error: reference to 'data' is ambiguous 19 | data in[1000]; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:4:7: note: 'class data' 4 | class data{ | ^~~~ a.cc:20:16: error: 'in' was not declared in this scope; did you mean 'i'? 20 | while(cin >> in[i].words){ | ^~ | i a.cc:25:8: error: 'in' was not declared in this scope; did you mean 'i'? 25 | sort(in,in+i); | ^~ | i a.cc:25:3: error: 'sort' was not declared in this scope; did you mean 'short'? 25 | sort(in,in+i); | ^~~~ | short
s069633117
p00105
C++
#include<iostream> #include<functional> #include<string> #include<map> #include<queue> #include<vector> using namespace std; typedef pair<string,int> P; int main(){ string s,temp; int x; priority_queue<int,vector<int>,greater<int>()> que; multimap<string,int> box; while(cin>>s>>x,x) box.insert(P(s,x)); box.insert(P("zzzzzzz",0)); multimap<string,int>::iterator ite; for(ite=box.begin();ite->second!=0;){ temp=ite->first; que.push(ite->second); ite++; while(ite->first==temp){ que.push(ite->second); ite++; } cout<<temp<<endl; cout<<que.top(); que.pop(); while(!que.empty()){ cout<<' '<<que.top(); que.pop(); } cout<<endl; } return 0; }
In file included from /usr/include/c++/14/queue:66, from a.cc:5: /usr/include/c++/14/bits/stl_queue.h: In instantiation of 'class std::priority_queue<int, std::vector<int>, std::greater<int>()>': a.cc:12:49: required from here 12 | priority_queue<int,vector<int>,greater<int>()> que; | ^~~ /usr/include/c++/14/bits/stl_queue.h:538:18: error: data member 'std::priority_queue<int, std::vector<int>, std::greater<int>()>::comp' invalidly declared function type 538 | _Compare comp; | ^~~~ a.cc: In function 'int main()': a.cc:12:56: error: no matching function for call to 'std::priority_queue<int, std::vector<int>, std::greater<int>()>::priority_queue()' 12 | priority_queue<int,vector<int>,greater<int>()> que; | ^~~ /usr/include/c++/14/bits/stl_queue.h:691:9: note: candidate: 'template<class _InputIterator, class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&, const _Alloc&) [with _Alloc = _InputIterator; _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 691 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:691:9: note: candidate expects 5 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:679:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 679 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:679:9: note: candidate expects 5 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:671:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 671 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:671:9: note: candidate expects 4 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:663:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 663 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:663:9: note: candidate expects 3 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:649:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 649 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:649:9: note: candidate expects 4 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:638:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 638 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:638:9: note: candidate expects 4 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:629:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 629 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:629:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:594:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(std::priority_queue<_Tp, _Sequence, _Compare>&&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 594 | priority_queue(priority_queue&& __q, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:594:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:590:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const std::priority_queue<_Tp, _Sequence, _Compare>&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 590 | priority_queue(const priority_queue& __q, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:590:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:585:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 585 | priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:585:9: note: candidate expects 3 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:579:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 579 | priority_queue(const _Compare& __x, const _Sequence& __c, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:579:9: note: candidate expects 3 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:573:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 573 | priority_queue(const _Compare& __x, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:573:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:569:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 569 | priority_queue(const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:569:9: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_queue.h:554:9: note: candidate: 'template<class _Seq, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue() [with _Requires = _Seq; _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 554 | priority_queue() | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:554:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_queue.h:551:43: error: no type named 'type' in 'struct std::enable_if<false, void>' 551 | template<typename _Seq = _Sequence, typename _Requires = typename | ^~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:563:7: note: candidate: 'std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&) [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 563 | priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence()) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:563:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:558:7: note: candidate: 'std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&) [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::greater<int>()]' 558 | priority_queue(const _Compare& __x, const _Sequence& __s) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:558:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'std::priority_queue<int, std::vector<int>, std::greater<int>()>::priority_queue(const std::priority_queue<int, std::vector<int>, std::greater<int>()>&)' 496 | class priority_queue | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'std::priority_queue<int, std::vector<int>, std::greater<int>()>::priority_queue(std::priority_queue<int, std::vector<int>, std::greater<int>()>&&)' /
s197603791
p00105
C++
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
a.cc:1:1: error: 'style' does not name a type 1 | style 12 | ^~~~~
s338669392
p00105
C++
#include<cstdio> #include<cmath> #include<string> #include<vector> #include<queue> using namespace std; #define PSI pair<string,int> vector<PSI> book; int main(void){ int x; char tmp[1024]; while(scanf("%s%d",tmp,&x)!=EOF){ string a; a = tmp; book.push_back(PSI(a,x)); } sort(book.begin(),book.end()); for(int i = 0; i < book.size(); i++){ vector<int> ans; puts(book[i].first.c_str()); ans.push_back(book[i].second); while(i+1<book.size() && book[i+1].first==book[i].first){ i++; ans.push_back(book[i].second); } sort(ans.begin(),ans.end()); for(int j = 0; j < ans.size(); j++){ if(j != 0)printf(" "); printf("%d",ans[j]); }puts(""); } return 0; }
a.cc: In function 'int main()': a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 22 | sort(book.begin(),book.end()); | ^~~~ | sqrt
s270880319
p00105
C++
int main(){ std::string s; int p; std::map<std::string,std::vector<int> > m; while(std::cin>>s>>p,p!=0){ m[s].push_back(p); } std::map<std::string,std::vector<int> >::iterator m_it = m.begin(); while(m_it!=m.end()){ std::cout<<(*m_it).first<<std::endl; std::vector<int> v = (*m_it).second; std::sort(v.begin(),v.end()); std::vector<int>::iterator v_it = v.begin(); while(v_it!=v.end()){ std::cout<<*v_it; v_it++; (v_it==v.end())?std::cout<<std::endl:std::cout<<" "; } m_it++; } return 0; }
a.cc: In function 'int main()': a.cc:2:8: error: 'string' is not a member of 'std' 2 | std::string s; | ^~~~~~ a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' +++ |+#include <string> 1 | int main(){ a.cc:4:8: error: 'map' is not a member of 'std' 4 | std::map<std::string,std::vector<int> > m; | ^~~ a.cc:1:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>' +++ |+#include <map> 1 | int main(){ a.cc:4:17: error: 'string' is not a member of 'std' 4 | std::map<std::string,std::vector<int> > m; | ^~~~~~ a.cc:4:17: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' a.cc:4:29: error: 'vector' is not a member of 'std' 4 | std::map<std::string,std::vector<int> > m; | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | int main(){ a.cc:4:36: error: expected primary-expression before 'int' 4 | std::map<std::string,std::vector<int> > m; | ^~~ a.cc:5:14: error: 'cin' is not a member of 'std' 5 | while(std::cin>>s>>p,p!=0){ | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | int main(){ a.cc:5:19: error: 's' was not declared in this scope 5 | while(std::cin>>s>>p,p!=0){ | ^ a.cc:6:5: error: 'm' was not declared in this scope 6 | m[s].push_back(p); | ^ a.cc:8:8: error: 'map' is not a member of 'std' 8 | std::map<std::string,std::vector<int> >::iterator m_it = m.begin(); | ^~~ a.cc:8:8: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>' a.cc:8:17: error: 'string' is not a member of 'std' 8 | std::map<std::string,std::vector<int> >::iterator m_it = m.begin(); | ^~~~~~ a.cc:8:17: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' a.cc:8:29: error: 'vector' is not a member of 'std' 8 | std::map<std::string,std::vector<int> >::iterator m_it = m.begin(); | ^~~~~~ a.cc:8:29: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:8:36: error: expected primary-expression before 'int' 8 | std::map<std::string,std::vector<int> >::iterator m_it = m.begin(); | ^~~ a.cc:9:9: error: 'm_it' was not declared in this scope 9 | while(m_it!=m.end()){ | ^~~~ a.cc:9:15: error: 'm' was not declared in this scope 9 | while(m_it!=m.end()){ | ^ a.cc:10:10: error: 'cout' is not a member of 'std' 10 | std::cout<<(*m_it).first<<std::endl; | ^~~~ a.cc:10:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:10:36: error: 'endl' is not a member of 'std' 10 | std::cout<<(*m_it).first<<std::endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | int main(){ a.cc:11:10: error: 'vector' is not a member of 'std' 11 | std::vector<int> v = (*m_it).second; | ^~~~~~ a.cc:11:10: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:11:17: error: expected primary-expression before 'int' 11 | std::vector<int> v = (*m_it).second; | ^~~ a.cc:12:10: error: 'sort' is not a member of 'std' 12 | std::sort(v.begin(),v.end()); | ^~~~ a.cc:12:15: error: 'v' was not declared in this scope 12 | std::sort(v.begin(),v.end()); | ^ a.cc:13:10: error: 'vector' is not a member of 'std' 13 | std::vector<int>::iterator v_it = v.begin(); | ^~~~~~ a.cc:13:10: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:13:17: error: expected primary-expression before 'int' 13 | std::vector<int>::iterator v_it = v.begin(); | ^~~ a.cc:14:11: error: 'v_it' was not declared in this scope 14 | while(v_it!=v.end()){ | ^~~~ a.cc:15:12: error: 'cout' is not a member of 'std' 15 | std::cout<<*v_it; | ^~~~ a.cc:15:12: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:17:28: error: 'cout' is not a member of 'std' 17 | (v_it==v.end())?std::cout<<std::endl:std::cout<<" "; | ^~~~ a.cc:17:28: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:17:39: error: 'endl' is not a member of 'std' 17 | (v_it==v.end())?std::cout<<std::endl:std::cout<<" "; | ^~~~ a.cc:17:39: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' a.cc:17:49: error: 'cout' is not a member of 'std' 17 | (v_it==v.end())?std::cout<<std::endl:std::cout<<" "; | ^~~~ a.cc:17:49: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s465779207
p00105
C++
#include<iostream> #include<string> #include<vector> using namespace std; class tWord{ public: friend tWord; string word; vector<int> page; tWord( string w ); friend bool operator <( const tWord& l, const tWord& r ){ return (strcmp(l.word.c_str(), r.word.c_str())<0); } }; tWord::tWord( string w ){ word = w; page.clear(); } int main(){ vector<tWord> words; string line; int n; char w[31]; // input while(1){ getline( cin, line ); if( line.size()==0 ) break; sscanf(line.c_str(), "%s %d", w, &n); int i; for( i=0; i<words.size(); i++ ){ if( words[i].word == w ){ break; } } if( i == words.size() ){ string ww = w; words.push_back(ww); } words[i].page.push_back(n); } // output sort( words.begin(), words.end() ); for( int i=0; i<words.size(); i++ ){ if( words[i].word != "" ){ cout << words[i].word << endl; sort( words[i].page.begin(), words[i].page.end() ); cout << words[i].page[0]; for( int j=1; j<words[i].page.size(); j++ ){ cout << " " << words[i].page[j]; } cout << endl; } } return 0; }
a.cc:8:16: warning: class 'tWord' is implicitly friends with itself 8 | friend tWord; | ^~~~~ a.cc: In function 'bool operator<(const tWord&, const tWord&)': a.cc:13:25: error: 'strcmp' was not declared in this scope 13 | return (strcmp(l.word.c_str(), r.word.c_str())<0); | ^~~~~~ a.cc:4:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<vector> +++ |+#include <cstring> 4 | using namespace std; a.cc: In function 'int main()': a.cc:46:9: error: 'sort' was not declared in this scope; did you mean 'short'? 46 | sort( words.begin(), words.end() ); | ^~~~ | short
s489653584
p00105
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; class tWord{ public: string word; vector<int> page; tWord( string w ); bool operator <( const tWord& r ){ return (strcmp(word.c_str(), r.word.c_str())<0); } }; tWord::tWord( string w ){ word = w; page.clear(); } int main(){ vector<tWord> words; string line; int n; char w[31]; // input while(1){ getline( cin, line ); if( line.size()==0 ) break; sscanf(line.c_str(), "%s %d", w, &n); int i; for( i=0; i<words.size(); i++ ){ if( words[i].word == w ){ break; } } if( i == words.size() ){ string ww = w; words.push_back(ww); } words[i].page.push_back(n); } // output sort( words.begin(), words.end() ); for( int i=0; i<words.size(); i++ ){ if( words[i].word != "" ){ cout << words[i].word << endl; sort( words[i].page.begin(), words[i].page.end() ); cout << words[i].page[0]; for( int j=1; j<words[i].page.size(); j++ ){ cout << " " << words[i].page[j]; } cout << endl; } } return 0; }
a.cc: In member function 'bool tWord::operator<(const tWord&)': a.cc:13:25: error: 'strcmp' was not declared in this scope 13 | return (strcmp(word.c_str(), r.word.c_str())<0); | ^~~~~~ a.cc:5:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<algorithm> +++ |+#include <cstring> 5 | using namespace std;
s730175605
p00105
C++
#include <iostream> #include <vector> #include <map> #include <cstdio> using namespace std; string char_to_str(char *c) { string ret = ""; for (; *c; ++c) ret += *c; return ret; } int main() { map<string, vector<int> > m; vector<string> words; char word[50]; int page; while (scanf("%s%d\n", word, &page) != EOF) { string str = char_to_str(word); m[str].push_back(page); words.push_back(str); } sort( words.begin(), words.end() ); words.erase( unique( words.begin(), words.end() ), words.end() ); for (int i = 0; i < words.size(); ++i) { vector<int> v = m[words[i]]; sort( v.begin(), v.end() ); cout << words[i] << endl; for (int j = 0; j < v.size(); ++j) { cout << v[j]; if (j+1 < v.size()) cout << " "; } cout << endl; } }
a.cc: In function 'int main()': a.cc:28:9: error: 'sort' was not declared in this scope; did you mean 'short'? 28 | sort( words.begin(), words.end() ); | ^~~~ | short a.cc:29:22: error: 'unique' was not declared in this scope 29 | words.erase( unique( words.begin(), words.end() ), words.end() ); | ^~~~~~
s699367235
p00105
C++
#include<iostream> #include<map> #include<string> #include<vector> #include<algorithm> #include<set> using namespace std; int main(void){ string index; int page; map<string,set<int> >dic; while(cin >> index >> page) dic[index].insert(page); map<string,set<int> >::iterator it = dic.begin(); for(;it != dic.end();it++){ cout << it->first << endl; set<int>::iterator its = (it->second).begin(); while(its != (it->second).end()){ cout << *its; cout << (++its != (it->second).end() ? " " : endl); } } return 0; }
a.cc: In function 'int main()': a.cc:27:58: error: overloaded function with no contextual type information 27 | cout << (++its != (it->second).end() ? " " : endl); | ^~~~
s611768109
p00105
C++
int main(){ string a; int b; map<string,set<int> > kok; map<string,set<int> >::iterator it; while(cin >> a >> b){ it = kok.find(a); if(it != kok.end()) it->second.insert(b); else{ set<int> p; p.insert(b); kok[a] = p; } } for(it=kok.begin(); it!=kok.end(); ++it){ cout << it->first << endl; set<int>::iterator i; int u = 0; for(i=it->second.begin(); i!=it->second.end(); ++i){ cout << *i; if(u != it->second.size()-1) cout << " "; u++; } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:2:3: error: 'string' was not declared in this scope 2 | string a; | ^~~~~~ a.cc:4:3: error: 'map' was not declared in this scope 4 | map<string,set<int> > kok; | ^~~ a.cc:4:14: error: 'set' was not declared in this scope 4 | map<string,set<int> > kok; | ^~~ a.cc:4:18: error: expected primary-expression before 'int' 4 | map<string,set<int> > kok; | ^~~ a.cc:5:18: error: expected primary-expression before 'int' 5 | map<string,set<int> >::iterator it; | ^~~ a.cc:6:9: error: 'cin' was not declared in this scope 6 | while(cin >> a >> b){ | ^~~ a.cc:6:16: error: 'a' was not declared in this scope 6 | while(cin >> a >> b){ | ^ a.cc:7:5: error: 'it' was not declared in this scope; did you mean 'int'? 7 | it = kok.find(a); | ^~ | int a.cc:7:10: error: 'kok' was not declared in this scope 7 | it = kok.find(a); | ^~~ a.cc:11:11: error: expected primary-expression before 'int' 11 | set<int> p; | ^~~ a.cc:12:7: error: 'p' was not declared in this scope 12 | p.insert(b); | ^ a.cc:16:7: error: 'it' was not declared in this scope; did you mean 'int'? 16 | for(it=kok.begin(); it!=kok.end(); ++it){ | ^~ | int a.cc:16:10: error: 'kok' was not declared in this scope 16 | for(it=kok.begin(); it!=kok.end(); ++it){ | ^~~ a.cc:17:5: error: 'cout' was not declared in this scope 17 | cout << it->first << endl; | ^~~~ a.cc:17:26: error: 'endl' was not declared in this scope 17 | cout << it->first << endl; | ^~~~ a.cc:18:9: error: expected primary-expression before 'int' 18 | set<int>::iterator i; | ^~~ a.cc:20:9: error: 'i' was not declared in this scope 20 | for(i=it->second.begin(); i!=it->second.end(); ++i){ | ^
s326226377
p00105
C++
#include <iostream> #include <map> #include <set> #include <string> using namespace std; map<string,set<int>> p; int main() { string str; int t; while (cin >> str >> t) p[str].insert(t); for (auto it = p.begin(); it != p.end(); it++) { cout << it->first << endl << it->second[0]; for (int j = 1; j < it->second.size(); j++) cout << " " << it->second[j]; cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:15:49: error: no match for 'operator[]' (operand types are 'std::set<int>' and 'int') 15 | cout << it->first << endl << it->second[0]; | ^ a.cc:17:38: error: no match for 'operator[]' (operand types are 'std::set<int>' and 'int') 17 | cout << " " << it->second[j]; | ^
s589374751
p00105
C++
#include <iostream> #include <map> #include <set> #include <string> using namespace std; map<string,vector<int> > p; int main() { string str; int t; while (cin >> str >> t) p[str].insert(t); for (auto it = p.begin(); it != p.end(); it++) { auto s = it->second.bigen(); cout << it->first << endl << *s; for (++s; s != it->second.end(); s++) cout << " " << *s; cout << endl; } return 0; }
a.cc:7:12: error: 'vector' was not declared in this scope 7 | map<string,vector<int> > p; | ^~~~~~ a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 3 | #include <set> +++ |+#include <vector> 4 | #include <string> a.cc:7:22: error: template argument 2 is invalid 7 | map<string,vector<int> > p; | ^ a.cc:7:22: error: template argument 4 is invalid a.cc:7:24: error: expected unqualified-id before '>' token 7 | map<string,vector<int> > p; | ^ a.cc: In function 'int main()': a.cc:13:29: error: 'p' was not declared in this scope 13 | while (cin >> str >> t) p[str].insert(t); | ^ a.cc:14:20: error: 'p' was not declared in this scope 14 | for (auto it = p.begin(); it != p.end(); it++) { | ^
s905725104
p00105
C++
#include <iostream> #include <map> #include <set> #include <string> using namespace std; map<string,set<int>> p; int main() { string str; int t; while (cin >> str >> t) p[str].insert(t); for (auto it = p.begin(); it != p.end(); it++) { auto s = it->second.bigen(); cout << it->first << endl << *s; for (++s; s != it->second.end(); s++) cout << " " << *s; cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:15:29: error: 'class std::set<int>' has no member named 'bigen' 15 | auto s = it->second.bigen(); | ^~~~~
s629930769
p00105
C++
#include <iostream> #include <map> #include <set> #include <string> using namespace std; map<string,set<int>> p; int main() { string str; int t; while (cin >> str >> t) p[str].insert(t); for (auto it = p.begin(); it != p.end(); it++) { auto s = it->second.bigen(); cout << it->first << endl << *s; for (++s; s != it->second.end(); s++) cout << " " << *s; cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:15:29: error: 'class std::set<int>' has no member named 'bigen' 15 | auto s = it->second.bigen(); | ^~~~~
s413493168
p00105
C++
#include<cstdio> #include<map> #include<vector> #include<algorithm> #include<string> #include<iostream> using namespace std; int main(void) { map<string,vector<int> > index; vector<string> name; string key; int page; while((cin>>key>>page)) { int flg=0; for(int f1=0;f1<name.size();f1++) { if(name[f1]==key)flg=1; } if(!flg)name.push_back(key); index[key].push_back(page); } sort(name.begin(),name.end()); for(int f1=0;f1<name.size();f1++) { sort(index[name[f1]].begin(),index[name[f1]].end()); cout<<name[f1]<<endl; for(int f2=0;f2<index[name[f1]].size();f2++) { cout<<index[name[f1]][f2]<<" "; } cout<<endl; } /* fflush(stdin); getchar(); */ return 0; }
a.cc:10:31: error: extended character   is not valid in an identifier 10 | map<string,vector<int> > index; | ^ a.cc: In function 'int main()': a.cc:10:33: error: template argument 2 is invalid 10 | map<string,vector<int> > index; | ^ a.cc:10:33: error: template argument 4 is invalid a.cc:22:22: error: no match for 'operator[]' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 22 | index[key].push_back(page); | ^ a.cc:27:27: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'}) 27 | sort(index[name[f1]].begin(),index[name[f1]].end()); | ^ a.cc:27:51: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'}) 27 | sort(index[name[f1]].begin(),index[name[f1]].end()); | ^ a.cc:29:38: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'}) 29 | for(int f2=0;f2<index[name[f1]].size();f2++) | ^ a.cc:31:36: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'}) 31 | cout<<index[name[f1]][f2]<<" "; | ^
s028882186
p00105
C++
#include<iostream> #include<string> #include<vector> #include<map> #include<queue> #include<algorithm> using namespace std; int main(){ string inWord, num; map<string, string> word; map<string, string>::iterator itr; while(cin >> inWord >> " " >> num){ if(!word[inWord].empty()){ word[inWord] = num; }else{ word[inWord] += " " + num; } } sort(word.begin(), word.end()); for(itr = word.begin(); itr != word.end(); itr++){ cout << itr -> first << endl; cout << itr -> secound << endl; } }
a.cc: In function 'int main()': a.cc:15:25: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>' and 'const char [2]') 15 | while(cin >> inWord >> " " >> num){ | ~~~~~~~~~~~~~ ^~ ~~~ | | | | | const char [2] | std::basic_istream<char> In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:15:28: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'const char*' 15 | while(cin >> inWord >> " " >> num){ | ^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:15:28: error: invalid conversion from 'const char*' to 'short int' [-fpermissive] 15 | while(cin >> inWord >> " " >> num){ | ^~~ | | | const char* a.cc:15:28: error: cannot bind rvalue '(short int)((const char*)" ")' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:15:28: error: invalid conversion from 'const char*' to 'short unsigned int' [-fpermissive] 15 | while(cin >> inWord >> " " >> num){ | ^~~ | | | const char* a.cc:15:28: error: cannot bind rvalue '(short unsigned int)((const char*)" ")' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:15:28: error: invalid conversion from 'const char*' to 'int' [-fpermissive] 15 | while(cin >> inWord >> " " >> num){ | ^~~ | | | const char* a.cc:15:28: error: cannot bind rvalue '(int)((const char*)" ")' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:15:28: error: invalid conversion from 'const char*' to 'unsigned int' [-fpermissive] 15 | while(cin >> inWord >> " " >> num){ | ^~~ | | | const char* a.cc:15:28: error: cannot bind rvalue '(unsigned int)((const char*)" ")' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:15:28: error: invalid conversion from 'const char*' to 'long int' [-fpermissive] 15 | while(cin >> inWord >> " " >> num){ | ^~~ | | | const char* a.cc:15:28: error: cannot bind rvalue '(long int)((const char*)" ")' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:15:28: error: invalid conversion from 'const char*' to 'long unsigned int' [-fpermissive] 15 | while(cin >> inWord >> " " >> num){ | ^~~ | | | const char* a.cc:15:28: error: cannot bind rvalue '(long unsigned int)((const char*)" ")' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:15:28: error: invalid conversion from 'const char*' to 'long long int' [-fpermissive] 15 | while(cin >> inWord >> " " >> num){ | ^~~ | | | const char* a.cc:15:28: error: cannot bind rvalue '(long long int)((const char*)" ")' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:15:28: error: invalid conversion from 'const char*' to 'long long unsigned int' [-fpermissive] 15 | while(cin >> inWord >> " " >> num){ | ^~~ | | | const char* a.cc:15:28: error: cannot bind rvalue '(long long unsigned int)((const char*)" ")' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:15:28: error: invalid conversion from 'const void*' to 'void*' [-fpermissive] 15 | while(cin >> inWord >> " " >> num){ | ^~~ | | | const void* a.cc:15:28: error: cannot bind rvalue '(void*)((const void*)((const char*)" "))' to 'void*&' /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'const char [2]' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'const char [2]' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'const char [2]' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'const char [2]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'
s332494128
p00106
Java
mport java.util.Arrays; import java.util.Scanner; public class Main { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); long start = System.currentTimeMillis(); long fin = System.currentTimeMillis(); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int M = 5000; int[] item = { 200, 300, 500, 1000, 1200, 1500 }; int[] price = { 380, 550, 850, 1520, 1870, 2244 }; int[] dp = new int[M + 1]; Arrays.fill(dp, Integer.MAX_VALUE / 2); dp[0] = 0; for (int i = 0; i < 6; i++) { for (int j = 0; j <= M; j++) { if (j + item[i] <= M && dp[j] != Integer.MAX_VALUE / 2) { dp[j + item[i]] = Math.min(dp[j + item[i]], dp[j] + price[i]); } } } for (;;) { int n = sc.nextInt(); if (n == 0) return; System.out.println(dp[n]); } } public static void main(String[] args) { new Main().run(); } void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } void debug2(char[][] array) { for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[i].length; j++) { System.out.print(array[i][j]); } System.out.println(); } } boolean inner(int h, int w, int limH, int limW) { return 0 <= h && h < limH && 0 <= w && w < limW; } void swap(int[] x, int a, int b) { int tmp = x[a]; x[a] = x[b]; x[b] = tmp; } // find minimum i (a[i] >= border) int lower_bound(int a[], int border) { int l = -1; int r = a.length; while (r - l > 1) { int mid = (l + r) / 2; if (border <= a[mid]) { r = mid; } else { l = mid; } } // r = l + 1 return r; } boolean palindrome(String s) { for (int i = 0; i < s.length() / 2; i++) { if (s.charAt(i) != s.charAt(s.length() - 1 - i)) { return false; } } return true; } class MyScanner { int nextInt() { try { int c = System.in.read(); while (c != '-' && (c < '0' || '9' < c)) c = System.in.read(); if (c == '-') return -nextInt(); int res = 0; do { res *= 10; res += c - '0'; c = System.in.read(); } while ('0' <= c && c <= '9'); return res; } catch (Exception e) { return -1; } } double nextDouble() { return Double.parseDouble(next()); } long nextLong() { return Long.parseLong(next()); } String next() { try { StringBuilder res = new StringBuilder(""); int c = System.in.read(); while (Character.isWhitespace(c)) c = System.in.read(); do { res.append((char) c); } while (!Character.isWhitespace(c = System.in.read())); return res.toString(); } catch (Exception e) { return null; } } int[] nextIntArray(int n) { int[] in = new int[n]; for (int i = 0; i < n; i++) { in[i] = nextInt(); } return in; } int[][] nextInt2dArray(int n, int m) { int[][] in = new int[n][m]; for (int i = 0; i < n; i++) { in[i] = nextIntArray(m); } return in; } double[] nextDoubleArray(int n) { double[] in = new double[n]; for (int i = 0; i < n; i++) { in[i] = nextDouble(); } return in; } long[] nextLongArray(int n) { long[] in = new long[n]; for (int i = 0; i < n; i++) { in[i] = nextLong(); } return in; } char[][] nextCharField(int n, int m) { char[][] in = new char[n][m]; for (int i = 0; i < n; i++) { String s = sc.next(); for (int j = 0; j < m; j++) { in[i][j] = s.charAt(j); } } return in; } } }
Main.java:1: error: class, interface, enum, or record expected mport java.util.Arrays; ^ Main.java:2: error: class, interface, enum, or record expected import java.util.Scanner; ^ 2 errors
s179405290
p00106
Java
/* * Copyright Narushima Hironori. All rights reserved. */ package aizuonlinejudge; import java.io.*; import java.util.*; /** * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106 */ public class Calculator { static class Shop { int price, volume, discountedPrice, discountedPer; public Shop(int volume, int price, double discount, int per) { this.volume = volume; this.price = price; discountedPrice = (int) (price * per - price * per * discount); discountedPer = per; } int calcPrice(int count) { int total = 0; while(count >= discountedPer) { total += discountedPrice; count -= discountedPer; } return total + price * count; } int maxBuyCount(int buyVolume) { return buyVolume / volume; } } public static void main(String[] args) throws IOException { Calculator calc = new Calculator(); BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); for (String l; (l = r.readLine()) != null;) { int volume = Integer.parseInt(l); if(volume == 0) { break; } System.out.println(calc.calc(volume)); } } Shop[] shops = { new Shop(200, 380, 0.20, 5), new Shop(300, 550, 0.15, 4), new Shop(500, 850, 0.12, 3), }; public int calc(int volume) { if(volume % 100 != 0) { throw new IllegalArgumentException(); } int[] buyCounts = new int[shops.length + 1]; List<int[]> results = new ArrayList<>(); calc(results, buyCounts, 0, volume); Collections.sort(results, new Comparator<int[]>() { @Override public int compare(int[] a, int[] b) { int ap = a[shops.length]; int bp = b[shops.length]; return ap < bp ? -1 : ap == bp ? 0 : 1; }; }); /* System.out.println("Volume=" + volume + "-------------------------------------------------------"); for (int[] r : results) { System.out.println(Arrays.toString(r)); } int[] r = results.get(0); System.out.println("Best buy=" + Arrays.toString(r)); for (int i = 0; i < r.length - 1; i++) { System.out.println( r[i] + " count buys from shop#" + i + " (" + (shops[i].volume * r[i]) + "g) " + shops[i].calcPrice(r[i])); } */ return results.get(0)[shops.length]; } void calc(List<int[]> results, int[] count, int shopIndex, int buyVolume) { if(shops.length == shopIndex) { if(buyVolume == 0) { int total = 0; for (int i = 0; i < shops.length; i++) { total += shops[i].calcPrice(count[i]); } count[shopIndex] = total; results.add(count.clone()); } } else { Shop shop = shops[shopIndex]; int maxBuyCount = shop.maxBuyCount(buyVolume); for (int buyCount = 0; buyCount <= maxBuyCount; buyCount++) { count[shopIndex] = buyCount; int nextBuyVolume = buyVolume - shop.volume * buyCount; calc(results, count, shopIndex + 1, nextBuyVolume); } } } void testShop() { System.out.println(shops[1].calcPrice(9)); if(shops[0].calcPrice(12) != 3800 || shops[1].calcPrice(9) != 4290) { throw new Error(); } } }
Main.java:12: error: class Calculator is public, should be declared in a file named Calculator.java public class Calculator { ^ 1 error
s841635455
p00106
Java
/* * Copyright Narushima Hironori. All rights reserved. */ package aizuonlinejudge; import java.io.*; import java.util.*; /** * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106 */ public class Calculator { static class Shop { int price, volume, discountedPrice, discountedPer; public Shop(int volume, int price, double discount, int per) { this.volume = volume; this.price = price; discountedPrice = (int) (price * per - price * per * discount); discountedPer = per; } int calcPrice(int count) { int total = 0; while(count >= discountedPer) { total += discountedPrice; count -= discountedPer; } return total + price * count; } int maxBuyCount(int buyVolume) { return buyVolume / volume; } } public static void main(String[] args) throws IOException { Calculator calc = new Calculator(); BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); for (String l; (l = r.readLine()) != null;) { int volume = Integer.parseInt(l); if(volume == 0) { break; } System.out.println(calc.calc(volume)); } } Shop[] shops = { new Shop(200, 380, 0.20, 5), new Shop(300, 550, 0.15, 4), new Shop(500, 850, 0.12, 3), }; public int calc(int volume) { if(volume % 100 != 0) { throw new IllegalArgumentException(); } int[] buyCounts = new int[shops.length + 1]; ArrayList<int[]> results = new ArrayList<>(); calc(results, buyCounts, 0, volume); Collections.sort(results, new Comparator<int[]>() { @Override public int compare(int[] a, int[] b) { int ap = a[shops.length]; int bp = b[shops.length]; return ap < bp ? -1 : ap == bp ? 0 : 1; }; }); /* System.out.println("Volume=" + volume + "-------------------------------------------------------"); for (int[] r : results) { System.out.println(Arrays.toString(r)); } int[] r = results.get(0); System.out.println("Best buy=" + Arrays.toString(r)); for (int i = 0; i < r.length - 1; i++) { System.out.println( r[i] + " count buys from shop#" + i + " (" + (shops[i].volume * r[i]) + "g) " + shops[i].calcPrice(r[i])); } */ return results.get(0)[shops.length]; } void calc(List<int[]> results, int[] count, int shopIndex, int buyVolume) { if(shops.length == shopIndex) { if(buyVolume == 0) { int total = 0; for (int i = 0; i < shops.length; i++) { total += shops[i].calcPrice(count[i]); } count[shopIndex] = total; results.add(count.clone()); } } else { Shop shop = shops[shopIndex]; int maxBuyCount = shop.maxBuyCount(buyVolume); for (int buyCount = 0; buyCount <= maxBuyCount; buyCount++) { count[shopIndex] = buyCount; int nextBuyVolume = buyVolume - shop.volume * buyCount; calc(results, count, shopIndex + 1, nextBuyVolume); } } } void testShop() { System.out.println(shops[1].calcPrice(9)); if(shops[0].calcPrice(12) != 3800 || shops[1].calcPrice(9) != 4290) { throw new Error(); } } }
Main.java:12: error: class Calculator is public, should be declared in a file named Calculator.java public class Calculator { ^ 1 error
s844488933
p00106
Java
/* * Copyright Narushima Hironori. All rights reserved. */ package aizuonlinejudge; import java.io.*; import java.util.*; /** * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106 */ public class Calculator { static class Shop { int price, volume, discountedPrice, discountedPer; public Shop(int volume, int price, double discount, int per) { this.volume = volume; this.price = price; discountedPrice = (int) (price * per - price * per * discount); discountedPer = per; } int calcPrice(int count) { int total = 0; while(count >= discountedPer) { total += discountedPrice; count -= discountedPer; } return total + price * count; } int maxBuyCount(int buyVolume) { return buyVolume / volume; } } public static void main(String[] args) throws IOException { Calculator calc = new Calculator(); BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); for (String l; (l = r.readLine()) != null;) { int volume = Integer.parseInt(l); if(volume == 0) { break; } System.out.println(calc.calc(volume)); } } Shop[] shops = { new Shop(200, 380, 0.20, 5), new Shop(300, 550, 0.15, 4), new Shop(500, 850, 0.12, 3), }; public int calc(int volume) { if(volume % 100 != 0) { throw new IllegalArgumentException(); } int[] buyCounts = new int[shops.length + 1]; List<int[]> results = new ArrayList<int[]>(); calc(results, buyCounts, 0, volume); Collections.sort(results, new Comparator<int[]>() { @Override public int compare(int[] a, int[] b) { int ap = a[shops.length]; int bp = b[shops.length]; return ap < bp ? -1 : ap == bp ? 0 : 1; }; }); /* System.out.println("Volume=" + volume + "-------------------------------------------------------"); for (int[] r : results) { System.out.println(Arrays.toString(r)); } int[] r = results.get(0); System.out.println("Best buy=" + Arrays.toString(r)); for (int i = 0; i < r.length - 1; i++) { System.out.println( r[i] + " count buys from shop#" + i + " (" + (shops[i].volume * r[i]) + "g) " + shops[i].calcPrice(r[i])); } */ return results.get(0)[shops.length]; } void calc(List<int[]> results, int[] count, int shopIndex, int buyVolume) { if(shops.length == shopIndex) { if(buyVolume == 0) { int total = 0; for (int i = 0; i < shops.length; i++) { total += shops[i].calcPrice(count[i]); } count[shopIndex] = total; results.add(count.clone()); } } else { Shop shop = shops[shopIndex]; int maxBuyCount = shop.maxBuyCount(buyVolume); for (int buyCount = 0; buyCount <= maxBuyCount; buyCount++) { count[shopIndex] = buyCount; int nextBuyVolume = buyVolume - shop.volume * buyCount; calc(results, count, shopIndex + 1, nextBuyVolume); } } } }
Main.java:12: error: class Calculator is public, should be declared in a file named Calculator.java public class Calculator { ^ 1 error
s315111748
p00106
Java
/* * Copyright Narushima Hironori. All rights reserved. */ import java.io.*; /** * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106 */ public class BuckwheatCalculator { static class Shop { int price, volume, discountedPrice, discountPer; Shop(int volume, int price, double discount, int per) { this.volume = volume; this.price = price; discountedPrice = (int) (price * per - price * per * discount); discountPer = per; } int calcPrice(int count) { int total = 0; while(count >= discountPer) { total += discountedPrice; count -= discountPer; } return total + price * count; } int maxBuyCount(int buyVolume) { return buyVolume / volume; } } Shop[] shops = { new Shop(200, 380, 0.20, 5), new Shop(300, 550, 0.15, 4), new Shop(500, 850, 0.12, 3) }; public int calc(int volume) { if(volume % 100 != 0) { throw new IllegalArgumentException(); } int[] buyCounts = new int[shops.length + 1]; buyCounts[shops.length] = Integer.MAX_VALUE; calc(buyCounts, 0, volume); return buyCounts[shops.length]; } void calc(int[] count, int shopIndex, int buyVolume) { if(shops.length == shopIndex) { if(buyVolume == 0) { int total = 0; for (int i = 0; i < shops.length; i++) { total += shops[i].calcPrice(count[i]); } if(count[shopIndex] > total) { count[shopIndex] = total; } } } else { Shop shop = shops[shopIndex]; int maxBuyCount = shop.maxBuyCount(buyVolume); for (int buyCount = 0; buyCount <= maxBuyCount; buyCount++) { count[shopIndex] = buyCount; int nextBuyVolume = buyVolume - shop.volume * buyCount; calc(count, shopIndex + 1, nextBuyVolume); } } } public static void main(String[] args) throws IOException { BuckwheatCalculator calculator = new BuckwheatCalculator(); BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); for (String l; (l = r.readLine()).length() > 0;) { int volume = Integer.parseInt(l); if(volume == 0) { break; } System.out.println(calculator.calc(volume)); } } }
Main.java:9: error: class BuckwheatCalculator is public, should be declared in a file named BuckwheatCalculator.java public class BuckwheatCalculator { ^ 1 error
s622859157
p00106
Java
import java.io.IOException; import java.util.Scanner; public class AOJ0106 { public static int[] A={200,380,5,20}; public static int[] B={300,550,4,15}; public static int[] C={500,850,3,12}; public static void main(String[] args)throws IOException{ Scanner scan = null; try{ scan = new Scanner(System.in); for(;;){ int d =scan.nextInt(); if(d ==0)break; System.out.println(Math.min(calc(d,A),Math.min(calc(d,B), calc(d,C)))); } }finally{ if(scan !=null)scan.close(); } } public static int calc(int size,int[] data){ int fukuro = size / data[0]; if(size%data[0] !=0)fukuro++; int nokori = fukuro % data[2]; int waribiki = fukuro -nokori; int nedan = waribiki * data[1] *(100 - data[3]) /100 + nokori * data[1]; return nedan; } }
Main.java:5: error: class AOJ0106 is public, should be declared in a file named AOJ0106.java public class AOJ0106 { ^ 1 error
s822017739
p00106
C
#include <stdio.h> /* ????????? */ #define U1 unsigned char #define S4 int #define U4 unsigned int /* ??????????????? */ #define MAX_ITEMS (50) #define END_MARK (0) #define MAX_GRAM (5000) #define MIN_GRAM (500) #define UNIT (100) /* ?????????DP??????????????????????????????????????? */ #define DP_TABLE_WEIGHT_SIZE ((MAX_GRAM) / (UNIT)) /* ?????°???????????¨????????????????????? */ #define TABLE_SIZE (6) const s4_g_buckwheat100Gram[TABLE_SIZE] = { 2, 3, 5, 10, 12, 15 }; const s4_g_buckwheatPrice[TABLE_SIZE] = { 380, 550, 850, 1520, 1870, 2244 }; static S4 s4_s_calcPrice(S4 s4_a_gram); S4 main() { U1 u1_t_delimiter; /* ??????????????? */ S4 s4_t_cnt; /* ????????????????????? */ S4 s4_t_input; /* ??\????????????????????? */ S4 s4_t_result; for (s4_t_cnt = (S4)0; s4_t_cnt < (S4)MAX_ITEMS; s4_t_cnt++) { scanf_s("%d%c", &s4_t_input, &u1_t_delimiter); if (s4_t_input == (S4)END_MARK) { break; } s4_t_result = s4_s_calcPrice(s4_t_input); printf("%d\n", s4_t_result); } return ((S4)(0)); } /* ?????°????????°?????°????????° */ /* ???????????????????????? */ static S4 s4_s_calcPrice(S4 s4_a_gram) { S4 s4_t_dp[TABLE_SIZE][DP_TABLE_WEIGHT_SIZE] = {0}; /* dp??????????¨???????????????°????¨????(ABC,??????????????§6?¨????)??¨?????°?????????/100???????????? */ S4 s4_t_itemIndex; S4 s4_t_weightIndex; S4 s4_t_100gram; /* ?????°????????????100??°?????????????????????????????? */ S4 s4_t_tmp; /* DP??´??°??¨ */ S4 s4_t_result; /* ???????????¨ */ S4 s4_t_i; S4 s4_t_j; s4_t_100gram = s4_a_gram / (S4)UNIT; /* ???????????????????????§????????? */ for (s4_t_i = (S4)0; s4_t_i < (S4)TABLE_SIZE; s4_t_i++) { for (s4_t_j = (S4)0; s4_t_j < (S4)DP_TABLE_WEIGHT_SIZE; s4_t_j++) { s4_t_dp[s4_t_i][s4_t_j] = (S4)99999999; } } s4_t_dp[0][2] = 380; s4_t_dp[1][3] = 550; for (s4_t_itemIndex = (S4)0; s4_t_itemIndex < (S4)TABLE_SIZE - 1; s4_t_itemIndex++) { /* 100g????????§DP????????????????????´??° */ for (s4_t_weightIndex = (S4)0; s4_t_weightIndex <= s4_t_100gram; s4_t_weightIndex++) { /* DP?¨????????????¢?????????????????????????????????????????§???????????´??? */ if (s4_g_buckwheat100Gram[s4_t_itemIndex] > s4_t_weightIndex) { s4_t_dp[s4_t_itemIndex + 1][s4_t_weightIndex] = s4_t_dp[s4_t_itemIndex][s4_t_weightIndex]; } else { /* DP?¨????????????¢??????????????????????????´????????????????????????????¨????????????¢???????????????????????????????????????????¨????????????¢?????????????????? */ s4_t_tmp = s4_t_dp[s4_t_itemIndex][s4_t_weightIndex - s4_g_buckwheat100Gram[s4_t_itemIndex]] + s4_g_buckwheatPrice[s4_t_itemIndex]; /* DP?¨????????????¢??????????????????????????´?????¨?????????????????£?????´?????§?????????????????¨ */ if (s4_t_tmp < s4_t_dp[s4_t_itemIndex][s4_t_weightIndex]) { s4_t_dp[s4_t_itemIndex + 1][s4_t_weightIndex] = s4_t_tmp; } else { s4_t_dp[s4_t_itemIndex + 1][s4_t_weightIndex] = s4_t_dp[s4_t_itemIndex][s4_t_weightIndex]; } } } } s4_t_result = s4_t_dp[TABLE_SIZE - 1][s4_t_100gram]; return (s4_t_result); }
main.c:18:7: error: type defaults to 'int' in declaration of 's4_g_buckwheat100Gram' [-Wimplicit-int] 18 | const s4_g_buckwheat100Gram[TABLE_SIZE] = { 2, 3, 5, 10, 12, 15 }; | ^~~~~~~~~~~~~~~~~~~~~ main.c:19:7: error: type defaults to 'int' in declaration of 's4_g_buckwheatPrice' [-Wimplicit-int] 19 | const s4_g_buckwheatPrice[TABLE_SIZE] = { 380, 550, 850, 1520, 1870, 2244 }; | ^~~~~~~~~~~~~~~~~~~ main.c: In function 'main': main.c:35:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 35 | scanf_s("%d%c", &s4_t_input, &u1_t_delimiter); | ^~~~~~~ | scanf
s733540498
p00106
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { int cost[3] = {380, 550, 850}; int weight[3] = {200, 300, 500}; int i, j; int ans[5001]; memset(ans, -1, sizeof(ans)); ans[0] = 0; for (i = 0; i < 3; i++){ for (j = 0; j + weight[i] <= 5000; j += 100){ if (ans[j] != -1){ if (ans[j + weight[i]] != -1){ if (min(ans[j + weight[i]], ans[j] + cost[i]) != ans[j + weight[i]]){ ans[j + weight[i]] = ans[j] + cost[i]; } } else { ans[j + weight[i]] = ans[j] + cost[i]; } } } } cost[0] = 380 * 5 * 0.8; cost[1] = 550 * 4 * 0.85; cost[2] = 850 * 3 * 0.88; for (i = 0; i < 3; i++){ for (j = 0; j + weight[i] * (5 - i) <= 5000; j += 100){ if (ans[j + weight[i] * (5 - i)] != -1){ if (min(ans[j + weight[i] * (5 - i)], ans[j] + cost[i]) != ans[j + weight[i] * (5 - i)]){ ans[j + weight[i] * (5 - i)] = ans[j] + cost[i]; } } else { ans[j + weight[i] * (5 - i)] = ans[j] + cost[i]; } } } while (1){ scanf("%d", &i); if (i == 0){ break; } printf("%d\n", ans[i]); } return (0); }
main.c: In function 'main': main.c:19:25: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration] 19 | if (min(ans[j + weight[i]], ans[j] + cost[i]) != ans[j + weight[i]]){ | ^~~ | main
s203119887
p00106
C
#include <strings.h> #include <stdio.h> #include <sys/limits.h> int min; int calc(int a, int b, int c) { int ma = (a / 5) * 5 * 380 * 0.8 + (a % 5) * 380; int mb = (b / 4) * 4 * 550 * 0.85 + (b % 4) * 550; int mc = (c / 3) * 3 * 850 * 0.88 + (c % 3) * 850; return ma + mb + mc; } void shopping(int amount) { int a, b, total; for (a = 0; a <= amount / 200; a++) { for (b = 0; b <= (amount - a*200) / 300; b++) { int remain = amount - a*200 - b*300; if (remain % 500 == 0) { total = calc(a, b, remain /500); if (min > total) min = total; } } } } int main(void) { int amount; while (scanf("%d", &amount), amount) { min = INT_MAX; shopping(amount); printf("%d\n", min); } return 0; }
main.c:3:10: fatal error: sys/limits.h: No such file or directory 3 | #include <sys/limits.h> | ^~~~~~~~~~~~~~ compilation terminated.
s542884813
p00106
C
a[6]={2,3,5,10,12,15},b[6]={380,550,850,1520,1870,2244},m[51],T; int s(n){int d=5;if(m[n]>9998)for(;~d;d--)if(a[d]<=n){T=s(p,n-a[d])+b[d];if(m[n]>T)m[n]=T;}return m[n];} main(n){for(n=1;n<51;n++)m[n]=9999;for(;scanf("%d",&n),n;)printf("%d\n",s(n/100));exit(0);}
main.c:1:1: warning: data definition has no type or storage class 1 | a[6]={2,3,5,10,12,15},b[6]={380,550,850,1520,1870,2244},m[51],T; | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:23: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int] 1 | a[6]={2,3,5,10,12,15},b[6]={380,550,850,1520,1870,2244},m[51],T; | ^ main.c:1:57: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 1 | a[6]={2,3,5,10,12,15},b[6]={380,550,850,1520,1870,2244},m[51],T; | ^ main.c:1:63: error: type defaults to 'int' in declaration of 'T' [-Wimplicit-int] 1 | a[6]={2,3,5,10,12,15},b[6]={380,550,850,1520,1870,2244},m[51],T; | ^ main.c: In function 's': main.c:2:5: error: type of 'n' defaults to 'int' [-Wimplicit-int] 2 | int s(n){int d=5;if(m[n]>9998)for(;~d;d--)if(a[d]<=n){T=s(p,n-a[d])+b[d];if(m[n]>T)m[n]=T;}return m[n];} | ^ main.c:2:59: error: 'p' undeclared (first use in this function) 2 | int s(n){int d=5;if(m[n]>9998)for(;~d;d--)if(a[d]<=n){T=s(p,n-a[d])+b[d];if(m[n]>T)m[n]=T;}return m[n];} | ^ main.c:2:59: note: each undeclared identifier is reported only once for each function it appears in main.c: At top level: main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int] 3 | main(n){for(n=1;n<51;n++)m[n]=9999;for(;scanf("%d",&n),n;)printf("%d\n",s(n/100));exit(0);} | ^~~~ main.c: In function 'main': main.c:3:1: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:3:41: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 3 | main(n){for(n=1;n<51;n++)m[n]=9999;for(;scanf("%d",&n),n;)printf("%d\n",s(n/100));exit(0);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | a[6]={2,3,5,10,12,15},b[6]={380,550,850,1520,1870,2244},m[51],T; main.c:3:41: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 3 | main(n){for(n=1;n<51;n++)m[n]=9999;for(;scanf("%d",&n),n;)printf("%d\n",s(n/100));exit(0);} | ^~~~~ main.c:3:41: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:3:59: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 3 | main(n){for(n=1;n<51;n++)m[n]=9999;for(;scanf("%d",&n),n;)printf("%d\n",s(n/100));exit(0);} | ^~~~~~ main.c:3:59: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:3:59: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:3:59: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:3:83: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 3 | main(n){for(n=1;n<51;n++)m[n]=9999;for(;scanf("%d",&n),n;)printf("%d\n",s(n/100));exit(0);} | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | a[6]={2,3,5,10,12,15},b[6]={380,550,850,1520,1870,2244},m[51],T; main.c:3:83: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 3 | main(n){for(n=1;n<51;n++)m[n]=9999;for(;scanf("%d",&n),n;)printf("%d\n",s(n/100));exit(0);} | ^~~~ main.c:3:83: note: include '<stdlib.h>' or provide a declaration of 'exit'
s684302078
p00106
C
a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;++n<51;)for(m[n]=1e5,d=5;~d;d--)a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d])&&m[n]=T;for(;~scanf("%d",&n);)n&&printf("%d\n",m[n/100]);}
main.c:1:1: warning: data definition has no type or storage class 1 | a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;++n<51;)for(m[n]=1e5,d=5;~d;d--)a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d])&&m[n]=T;for(;~scanf("%d",&n);)n&&printf("%d\n",m[n/100]);} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:22: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int] 1 | a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;++n<51;)for(m[n]=1e5,d=5;~d;d--)a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d])&&m[n]=T;for(;~scanf("%d",&n);)n&&printf("%d\n",m[n/100]);} | ^ main.c:1:55: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 1 | a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;++n<51;)for(m[n]=1e5,d=5;~d;d--)a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d])&&m[n]=T;for(;~scanf("%d",&n);)n&&printf("%d\n",m[n/100]);} | ^ main.c:1:61: error: return type defaults to 'int' [-Wimplicit-int] 1 | a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;++n<51;)for(m[n]=1e5,d=5;~d;d--)a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d])&&m[n]=T;for(;~scanf("%d",&n);)n&&printf("%d\n",m[n/100]);} | ^~~~ main.c: In function 'main': main.c:1:61: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:61: error: type of 'd' defaults to 'int' [-Wimplicit-int] main.c:1:61: error: type of 'T' defaults to 'int' [-Wimplicit-int] main.c:1:151: error: lvalue required as left operand of assignment 1 | a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;++n<51;)for(m[n]=1e5,d=5;~d;d--)a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d])&&m[n]=T;for(;~scanf("%d",&n);)n&&printf("%d\n",m[n/100]);} | ^ main.c:1:160: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;++n<51;)for(m[n]=1e5,d=5;~d;d--)a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d])&&m[n]=T;for(;~scanf("%d",&n);)n&&printf("%d\n",m[n/100]);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;++n<51;)for(m[n]=1e5,d=5;~d;d--)a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d])&&m[n]=T;for(;~scanf("%d",&n);)n&&printf("%d\n",m[n/100]);} main.c:1:160: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;++n<51;)for(m[n]=1e5,d=5;~d;d--)a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d])&&m[n]=T;for(;~scanf("%d",&n);)n&&printf("%d\n",m[n/100]);} | ^~~~~ main.c:1:160: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:179: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | a[]={2,3,5,10,12,15},b[]={380,550,850,1520,1870,2244},m[51];main(n,d,T){for(n=1;++n<51;)for(m[n]=1e5,d=5;~d;d--)a[d]<=n&&m[n]>(T=m[n-a[d]]+b[d])&&m[n]=T;for(;~scanf("%d",&n);)n&&printf("%d\n",m[n/100]);} | ^~~~~~ main.c:1:179: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:179: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:179: note: include '<stdio.h>' or provide a declaration of 'printf'
s841676832
p00106
C
#include<stdio.h> int minof(int min,int y){ min=(min<y)?min:y; return min; } int main(){ int min[51], g,i,j,k,l; while(1){ scanf("%d",&g); if(g==0){ break; }; g/=100; for(l=0;l<51;l+=1){ min[l]=100000; }; for(i=0;i<26;i+=1){ for(j=0;j<17;j+= 1){ for(k=0;k<11;k+=1){ if(2*i+3*j+5*k==g){ min[2*i+3*j+5*k]=minof(min[2*i+3*j+5*k],(i/5)*1520+(i%5)*380+(j/4)*1870+(j%4)*550+(k/3)*2244+(k%3)*850); }; }; }; }; printf("%d\n", min[g]); }; return 0;
main.c: In function 'main': main.c:30:3: error: expected declaration or statement at end of input 30 | return 0; | ^~~~~~
s800653937
p00106
C++
#include <iostream> #include <cstdio> using namespace std; #define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++) #define rep(x,to) rep2(x,0,to) int main() { while(1) { int m; cin >> m; if(m == 0) break; m /= 100; int ret = INT_MAX; rep(i,m/2+1) { rep(j,m/3+1) { rep(k,m/5+1) { if(i * 2 + j * 3 + k * 5 == m) { int sum = 0; sum += i * 380 + j * 550 + k * 850; sum -= i / 5 * (int) (380 * 5 * 0.2) + j / 4 * (int) (550 * 4 * 0.15) + k / 3 * (int) (850 * 3 * 0.12); if(sum < ret) { ret = sum; } } } } } cout << ret << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:27: error: 'INT_MAX' was not declared in this scope 13 | int ret = INT_MAX; | ^~~~~~~ a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include <cstdio> +++ |+#include <climits> 3 | using namespace std;
s161574311
p00106
C++
#include<iostream> #include<vector> using namespace std; struct soba{ double gram; double yen; soba(double g, double y){gram=g;yen=y;} }; double n; double min_y; vector<soba> v; void buy(double sum_g, double sum_y){ int len = v.size(); for(int i=0;i < len;i++){ if(sum_g == n){ min_y = min(min_y, sum_y); return; }else if(sum_g > n){ break; } buy(sum_g+v[i].gram, sum_y+v[i].yen); } return; } int main(){ int sum_g, sum_y; v.push_back(soba(200,380)); v.push_back(soba(200*5, (380*5) * 0.8)); v.push_back(soba(300,550)); v.push_back(soba(300*4, (550*4) * 0.85)); v.push_back(soba(500,850)); v.push_back(soba(500*3, (850*3) * 0.88)); while(true){ cin>>n; if(n==0) break; min_y = DBL_MAX; buy(0,0); cout<<int(min_y)<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:41:25: error: 'DBL_MAX' was not declared in this scope 41 | min_y = DBL_MAX; | ^~~~~~~ a.cc:3:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>' 2 | #include<vector> +++ |+#include <cfloat> 3 | using namespace std;
s259566750
p00106
C++
mport java.util.Arrays; import java.util.Scanner; public class Main { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); long start = System.currentTimeMillis(); long fin = System.currentTimeMillis(); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int M = 5000; int[] item = { 200, 300, 500, 1000, 1200, 1500 }; int[] price = { 380, 550, 850, 1520, 1870, 2244 }; int[] dp = new int[M + 1]; Arrays.fill(dp, Integer.MAX_VALUE / 2); dp[0] = 0; for (int i = 0; i < 6; i++) { for (int j = 0; j <= M; j++) { if (j + item[i] <= M && dp[j] != Integer.MAX_VALUE / 2) { dp[j + item[i]] = Math.min(dp[j + item[i]], dp[j] + price[i]); } } } for (;;) { int n = sc.nextInt(); if (n == 0) return; System.out.println(dp[n]); } } public static void main(String[] args) { new Main().run(); } void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } void debug2(char[][] array) { for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[i].length; j++) { System.out.print(array[i][j]); } System.out.println(); } } boolean inner(int h, int w, int limH, int limW) { return 0 <= h && h < limH && 0 <= w && w < limW; } void swap(int[] x, int a, int b) { int tmp = x[a]; x[a] = x[b]; x[b] = tmp; } // find minimum i (a[i] >= border) int lower_bound(int a[], int border) { int l = -1; int r = a.length; while (r - l > 1) { int mid = (l + r) / 2; if (border <= a[mid]) { r = mid; } else { l = mid; } } // r = l + 1 return r; } boolean palindrome(String s) { for (int i = 0; i < s.length() / 2; i++) { if (s.charAt(i) != s.charAt(s.length() - 1 - i)) { return false; } } return true; } class MyScanner { int nextInt() { try { int c = System.in.read(); while (c != '-' && (c < '0' || '9' < c)) c = System.in.read(); if (c == '-') return -nextInt(); int res = 0; do { res *= 10; res += c - '0'; c = System.in.read(); } while ('0' <= c && c <= '9'); return res; } catch (Exception e) { return -1; } } double nextDouble() { return Double.parseDouble(next()); } long nextLong() { return Long.parseLong(next()); } String next() { try { StringBuilder res = new StringBuilder(""); int c = System.in.read(); while (Character.isWhitespace(c)) c = System.in.read(); do { res.append((char) c); } while (!Character.isWhitespace(c = System.in.read())); return res.toString(); } catch (Exception e) { return null; } } int[] nextIntArray(int n) { int[] in = new int[n]; for (int i = 0; i < n; i++) { in[i] = nextInt(); } return in; } int[][] nextInt2dArray(int n, int m) { int[][] in = new int[n][m]; for (int i = 0; i < n; i++) { in[i] = nextIntArray(m); } return in; } double[] nextDoubleArray(int n) { double[] in = new double[n]; for (int i = 0; i < n; i++) { in[i] = nextDouble(); } return in; } long[] nextLongArray(int n) { long[] in = new long[n]; for (int i = 0; i < n; i++) { in[i] = nextLong(); } return in; } char[][] nextCharField(int n, int m) { char[][] in = new char[n][m]; for (int i = 0; i < n; i++) { String s = sc.next(); for (int j = 0; j < m; j++) { in[i][j] = s.charAt(j); } } return in; } } }
a.cc:1:1: error: 'mport' does not name a type 1 | mport java.util.Arrays; | ^~~~~ a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Scanner; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class Main { | ^~~~~~
s270814756
p00106
C++
#include<iostream> using nameaspace std; //????????? #define AG 200 #define BG 300 #define CG 500 //????????? #define AM 380 #define BM 550 #define CM 850 //?????????????????? #define AN 5 #define BN 4 #define CN 3 //?????????????????? #define AP 20 #define BP 15 #define BP 12 int main(){ int g; int a,b,c; int total; int money,work; while(1){ cin>>g; if(g==0){break;} a=0;b=0;c=0; total=0;money=0; for(c=0;c*CG<=g;c++){ for(b=0;c*CG+b*BG<=g;b++){ total=c*CG+b*BG; a=(g-total)/200; total+=a*AG; if(total!=g){continue;} //???????¨???? work=(a/AN)*AN*AM*AP/100+(a%AN)*AM + (b/BN)*BN*BM*BP/100+(b%BN)*BM + (c/CN)*CN*CM*CP/100+(c%CN)*CM; if(money<work){money=work;} } } cout<<money<<endl; } return 0; }
a.cc:19:9: warning: "BP" redefined 19 | #define BP 12 | ^~ a.cc:18:9: note: this is the location of the previous definition 18 | #define BP 15 | ^~ a.cc:2:7: error: expected nested-name-specifier before 'nameaspace' 2 | using nameaspace std; | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:28:10: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 28 | cin>>g; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:40:99: error: 'CP' was not declared in this scope; did you mean 'CG'? 40 | work=(a/AN)*AN*AM*AP/100+(a%AN)*AM + (b/BN)*BN*BM*BP/100+(b%BN)*BM + (c/CN)*CN*CM*CP/100+(c%CN)*CM; | ^~ | CG a.cc:45:10: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 45 | cout<<money<<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:45:23: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 45 | cout<<money<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s748235936
p00106
C++
#include<iostream> using namespace std; //????????? #define AG 200 #define BG 300 #define CG 500 //????????? #define AM 380 #define BM 550 #define CM 850 //?????????????????? #define AN 5 #define BN 4 #define CN 3 //?????????????????? #define AP 20 #define BP 15 #define BP 12 int main(){ int g; int a,b,c; int total; int money,work; while(1){ cin>>g; if(g==0){break;} a=0;b=0;c=0; total=0;money=0; for(c=0;c*CG<=g;c++){ for(b=0;c*CG+b*BG<=g;b++){ total=c*CG+b*BG; a=(g-total)/200; total+=a*AG; if(total!=g){continue;} //???????¨???? work=(a/AN)*AN*AM*AP/100+(a%AN)*AM + (b/BN)*BN*BM*BP/100+(b%BN)*BM + (c/CN)*CN*CM*CP/100+(c%CN)*CM; if(money<work){money=work;} } } cout<<money<<endl; } return 0; }
a.cc:19:9: warning: "BP" redefined 19 | #define BP 12 | ^~ a.cc:18:9: note: this is the location of the previous definition 18 | #define BP 15 | ^~ a.cc: In function 'int main()': a.cc:40:99: error: 'CP' was not declared in this scope; did you mean 'CG'? 40 | work=(a/AN)*AN*AM*AP/100+(a%AN)*AM + (b/BN)*BN*BM*BP/100+(b%BN)*BM + (c/CN)*CN*CM*CP/100+(c%CN)*CM; | ^~ | CG
s389369224
p00106
C++
#include <stdio.h> #include <algorithm> using namespace std; int n, ret; int main() { while(true) { scanf("%d", &n); if(n == 0) break; ret = 999999999; for(int a = 0; a <= 13; a++) { for(int b = 0; b <= 9; b++) { for(int c = 0; c <= 5; c++) { int value = a * 200 + b * 300 + c * 500; if(n == value) { ret = min(ret, (a / 5) * 1520 + (a % 5) * 380 + (b / 4) * 1870 * (b % 4) * 550 + (c / 3) * 2244 + (c % 3) * 850; } } } } printf("%d\n", ret); } return 0; }
a.cc: In function 'int main()': a.cc:15:136: error: expected ')' before ';' token 15 | ret = min(ret, (a / 5) * 1520 + (a % 5) * 380 + (b / 4) * 1870 * (b % 4) * 550 + (c / 3) * 2244 + (c % 3) * 850; | ~ ^ | )
s741999877
p00106
C++
??¶???????????°???????????°
a.cc:1:3: error: extended character ¶ is not valid in an identifier 1 | ??¶???????????°???????????° | ^ a.cc:1:15: error: extended character ° is not valid in an identifier 1 | ??¶???????????°???????????° | ^ a.cc:1:27: error: extended character ° is not valid in an identifier 1 | ??¶???????????°???????????° | ^ a.cc:1:1: error: expected unqualified-id before '?' token 1 | ??¶???????????°???????????° | ^
s094403220
p00106
C++
5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 5 8 105 | ^
s149006143
p00106
C++
include <iostream> #include <vector> using namespace std; #define MAXVALUE (1<<21) vector<int> dp(5000+1,MAXVALUE); void init(){ int item[6] = {200,300,500,1000,1200,1500}; int price[6]= {380,550,850,1520,1870,2244}; dp[0]=0; for(int k=0;k<6;k++){ for(int i=0;i+item[k]<=5000;i++){ dp[i+item[k]] = min( dp[i+item[k]] , dp[i]+price[k] ); } } } int main(){ init(); int n,mi; while(cin >> n && n){ mi = dp[n]; /*for(int i=n;i<=5000;i++){ mi = min(dp[i],mi); }*/ cout << mi << endl; } }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s610075934
p00106
C++
#include <iostream> int opts[6][2] = {{2, 380}, {3, 550}, {5, 850}, {10, 1520}, {12, 1870}, {15, 2244}}; int func(int qnt, int index, int subqnt, int subcost) { if (qnt == subqnt) return subcost; if (index < 0) return -1; int i = (qnt - subqnt) / opts[index][0]; int min_cost = INT_MAX; while (i >= 0) { int res = func(qnt, index - 1, subqnt + opts[index][0] * i, subcost + opts[index][1] * i); if (res > 0 && min_cost > res) min_cost = res; i--; } return min_cost; } int main() { int n; while (std::cin >> n && n > 0) { n /= 100; std::cout << func(n, 5, 0, 0) << std::endl; } }
a.cc: In function 'int func(int, int, int, int)': a.cc:10:20: error: 'INT_MAX' was not declared in this scope 10 | int min_cost = INT_MAX; | ^~~~~~~ a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include <iostream> +++ |+#include <climits> 2 |
s782305957
p00106
C++
#include<iostream> using namespace std; int main() { while(1){ int n; cin >> n; if(n==0) break; int min = 1000000; int fee; for(int a=0;a<=n/200+1;a++){ for(int b=0;b<=n/300+1;b++){ for(int c=0;c<=n/500+1;c++){ if(a*200+b*300+c*500==n){ fee=a*380+b*550+c*850; if(a>=5) fee+=((a/5)*5*380)*0.8-(a/5*5*380); if(b>=4) fee+=((b/4)*4*550)*0.85-(b/4*4*550); if(c>=3) fee+=((c/3)*3*850)*0.88-(c/3*3*850); if(min>fee) min=fee; }
a.cc: In function 'int main()': a.cc:21:14: error: expected '}' at end of input 21 | } | ^ a.cc:14:38: note: to match this '{' 14 | for(int c=0;c<=n/500+1;c++){ | ^ a.cc:21:14: error: expected '}' at end of input 21 | } | ^ a.cc:13:36: note: to match this '{' 13 | for(int b=0;b<=n/300+1;b++){ | ^ a.cc:21:14: error: expected '}' at end of input 21 | } | ^ a.cc:12:34: note: to match this '{' 12 | for(int a=0;a<=n/200+1;a++){ | ^ a.cc:21:14: error: expected '}' at end of input 21 | } | ^ a.cc:6:13: note: to match this '{' 6 | while(1){ | ^ a.cc:21:14: error: expected '}' at end of input 21 | } | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s452643311
p00106
C++
#include <stdio.h> #define MIN(a,b) ((a>b)? b:a) #define INT_MAX (1<<22) int dp[61]; int data[61]; int search(int remains){ if(dp[remains]) return data[remains]; if(remains == 0) return 0; if(remains == 1) return INT_MAX; int k=INT_MAX; if(remains >= 15) k = MIN(k, search(remains-15)+2244); if(remains >= 12) k = MIN(k, search(remains-12)+1870); if(remains >= 10) k = MIN(k, search(remains-10)+1520); if(remains >= 5) k = MIN(k, search(remains-5)+850); if(remains >= 3) k = MIN(k, search(remains-3)+550); if(remains >= 2) k = MIN(k, search(remains-2)+380); dp[remains] = 1; return data[remains] = k; } int main(){ int i; for(i=0;i<=60;i++) dp[i] = 0, data[i] = 0; search(60); int m = INT_MAX; /*for(i=60;i>=0;i--) { if(dp[i]) { m = data[i] = MIN(data[i], m); }else { data[i] = m; } }*/ int n; while(1){ scanf("%d", &n); if(n==0) break;
a.cc: In function 'int main()': a.cc:46:20: error: expected '}' at end of input 46 | if(n==0) break; | ^ a.cc:44:11: note: to match this '{' 44 | while(1){ | ^ a.cc:46:20: error: expected '}' at end of input 46 | if(n==0) break; | ^ a.cc:28:11: note: to match this '{' 28 | int main(){ | ^
s519664289
p00106
C++
#include <iostream> #include <algorithm> #include <cstdlib> using namespace std; int main(){ int weight; while(cin >> weight){ if(weight == 0) break; int minimum_cost = INT_MAX; for(int i = 0; (i-1) * 200 < weight; i++){ int w2 = weight - 200 * i; for(int j = 0; (j-1) * 300 < w2; j++){ int w3 = w2 - 300 * j; int k = 0; while(k * 500 < w3) k++; int cost = (i / 5) * 1520 + (i % 5) * 380 + (j / 4) * 1870 + (j % 4) * 550 + (k / 3) * 2244 + (k % 3) * 850; minimum_cost = min(minimum_cost, cost); } } cout << minimum_cost << endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:36: error: 'INT_MAX' was not declared in this scope 10 | int minimum_cost = INT_MAX; | ^~~~~~~ a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include <cstdlib> +++ |+#include <climits> 4 | using namespace std;
s650553006
p00106
C++
#include<iostream> #define INF 10000000 using namespace std; int main(){ int m[]={380,550,850,1520,1870,2244},dp[100010], w[]={2,3,5,10,12,15}; for(int i=0;i<=100000;i++) dp[i]=INF; dp[0]=0; for(int i=0;i<6;i++) for(int j=w[i];j<=100000;j++){ //if(dp[j-w[i]]==INF) //dp[j]=min(m[i],dp[j]); //else dp[j]=min(dp[j],dp[j-w[i]]+m[i]); if(j==22) //cout<<i<<' '<<dp[j]<<endl; } //for(int i=0;i<=2500;i++) //cout<<' '<<dp[i]<<endl; int n; while(cin>>n,n){ n/=100; int ans=INF; for(int i=n;i<=n+16;i++){ if(dp[i]!=INF) ans=min(ans,dp[i]); } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:18:9: error: expected primary-expression before '}' token 18 | } | ^
s776247749
p00106
C++
#include<iostream> #include<algorithm> using namespace std; #define NUM 6 #define MAX 5000 struct Data{int weight,cost;}; int main() { int n; int dp[MAX+1]={0}; Data item[NUM]={ {200,380},{300,550},{500,850},{1000,1520},{1200,1870},{1500,2244} }; for(int j=0;j<=MAX;j++)dp[j]=INT_MAX>>2; dp[0]=0; for(int i=0;i<NUM;i++){ for(int j=item[i].weight;j<=MAX;j++){ dp[j] = min( dp[j], dp[j-item[i].weight] + item[i].cost ); } } while(cin>>n,n){ cout<<dp[n]<<endl; } }
a.cc: In function 'int main()': a.cc:14:32: error: 'INT_MAX' was not declared in this scope 14 | for(int j=0;j<=MAX;j++)dp[j]=INT_MAX>>2; | ^~~~~~~ a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include<algorithm> +++ |+#include <climits> 3 | using namespace std;
s461224533
p00106
C++
#include <iostream> using namespace std; int main() { int combi[100000][3] = {0},m=0; int input,price[100000] = {0}; int a,b,c,a1,b1,c1; while(cin >> input) { if(input = 0) break; for(int i=0;i<26;i++) {//generate combination of weight over input for(int j=0;j<17;j++) { for(int k=0;k<11;k++) { if(input <= 200*i + 300*j + 500*k) { combi[m][0] = i; combi[m][1] = j; combi[m][2] = k; m++; } } } } for(int i=0;i<m;i++) {//calculate price[i] from combi[i] a = combi[i][0] / 5;//sale a1 = combi[i][0] - a*5;//not sale b = combi[i][1] / 4;//sale b1 = combi[i][1] - b*4;//not sale c = combi[i][2] / 3;//sale c1 = combi[i][2] - c*3;//not sale price[i] = 1520 * a + 380 * a1 + 1870 * b + 550 * b1 + 2244 * c + 850 * c1; } sort(price,price+m); cout << price[0] << endl; } }
a.cc: In function 'int main()': a.cc:34:5: error: 'sort' was not declared in this scope; did you mean 'short'? 34 | sort(price,price+m); | ^~~~ | short
s380752076
p00106
C++
#include <iostream> using namespace std; const int MAX_WEIGHT = 5000; const int MIN_WEIGHT = 500; struct Comodity{ int weight, price, unit; double rate; }; Comodity com_list[] = { { 200, 380, 5, 0.8 }, { 300, 550, 4, 0.85 }, { 500, 850, 3, 0.88 }, }; enum{ A, B, C, }; int quantity( int remain, int unit_weight ){ return remain > 0 ? remain / unit_weight + ( remain % unit_weight ? 1 : 0 ) : 0; } int calcPrice( int a, int b, int c ){ int dis_a = a / com_list[ A ].unit * com_list[ A ].unit; int dis_b = b / com_list[ B ].unit * com_list[ B ].unit; int dis_c = c / com_list[ C ].unit * com_list[ C ].unit; a -= dis_a; b -= dis_b; c -= dis_c; return ( a * com_list[ A ].price ) + ( b * com_list[ B ].price ) + ( c * com_list[ C ].price ) + (int)( dis_a * com_list[ A ].price * com_list[ A ].rate ) + (int)( dis_b * com_list[ B ].price * com_list[ B ].rate ) + (int)( dis_c * com_list[ C ].price * com_list[ C ].rate ); } int main() { int weight; while( cin >> weight && weight ){ int best_price = INT_MAX; int remain_a = weight; int a = quantity( remain_a, com_list[ A ].weight ); for( ; a >= 0; --a ){ int remain_b = remain_a - a * com_list[ A ].weight; int b = quantity( remain_b, com_list[ B ].weight ); for( ; b >= 0; --b ){ int remain_c = remain_b - b * com_list[ B ].weight; int c = quantity( remain_c, com_list[ C ].weight ); best_price = min( best_price, calcPrice( a, b, c ) ); } } cout << best_price << endl; } return 0; }
a.cc: In function 'int main()': a.cc:46:34: error: 'INT_MAX' was not declared in this scope 46 | int best_price = INT_MAX; | ^~~~~~~ a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include <iostream> +++ |+#include <climits> 2 | using namespace std;
s638091023
p00106
C++
#include <iostream> #include <cmath> using namespace std; const int MAX_WEIGHT = 5000; const int MIN_WEIGHT = 500; struct Comodity{ int weight, price, unit; double rate; }; Comodity com_list[] = { { 200, 380, 5, 0.8 }, { 300, 550, 4, 0.85 }, { 500, 850, 3, 0.88 }, }; enum{ A, B, C, }; int quantity( int remain, int unit_weight ){ return remain > 0 ? remain / unit_weight + ( remain % unit_weight ? 1 : 0 ) : 0; } int calcPrice( int a, int b, int c ){ int dis_a = a / com_list[ A ].unit * com_list[ A ].unit; int dis_b = b / com_list[ B ].unit * com_list[ B ].unit; int dis_c = c / com_list[ C ].unit * com_list[ C ].unit; a -= dis_a; b -= dis_b; c -= dis_c; return ( a * com_list[ A ].price ) + ( b * com_list[ B ].price ) + ( c * com_list[ C ].price ) + (int)( dis_a * com_list[ A ].price * com_list[ A ].rate ) + (int)( dis_b * com_list[ B ].price * com_list[ B ].rate ) + (int)( dis_c * com_list[ C ].price * com_list[ C ].rate ); } int main() { int weight; while( cin >> weight && weight ){ int best_price = INT_MAX; int remain_a = weight; int a = quantity( remain_a, com_list[ A ].weight ); for( ; a >= 0; --a ){ int remain_b = remain_a - a * com_list[ A ].weight; int b = quantity( remain_b, com_list[ B ].weight ); for( ; b >= 0; --b ){ int remain_c = remain_b - b * com_list[ B ].weight; int c = quantity( remain_c, com_list[ C ].weight ); best_price = min( best_price, calcPrice( a, b, c ) ); } } cout << best_price << endl; } return 0; }
a.cc: In function 'int main()': a.cc:47:34: error: 'INT_MAX' was not declared in this scope 47 | int best_price = INT_MAX; | ^~~~~~~ a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include <cmath> +++ |+#include <climits> 3 | using namespace std;
s375517532
p00106
C++
#include <iostream> #include <algorithm> using namespace std; const int inf = 999999; int main() { int r = inf, w; for(int i = 0; i <= 25; i++){ for(int j = 0; j <= 17; j++){ for(int k = 0; k <= 10; k++){ w = i*200+j*300+k*500; if(n == w){ r = min(r, (i/5)*1520 + (i%5)*380 + 1870*(j/4) + (j%4)*550 + 2244*(k/3) + (k%3)*850); } else if(n < w){ break; } } } }
a.cc: In function 'int main()': a.cc:16:8: error: 'n' was not declared in this scope 16 | if(n == w){ | ^ a.cc:23:4: error: expected '}' at end of input 23 | } | ^ a.cc:9:1: note: to match this '{' 9 | { | ^
s581219626
p00106
C++
#include <iostream> #include <algorithm> using namespace std; const int inf = 999999; int main() { int n; int r = inf, w; for(int i = 0; i <= 25; i++){ for(int j = 0; j <= 17; j++){ for(int k = 0; k <= 10; k++){ w = i*200+j*300+k*500; if(n == w){ r = min(r, (i/5)*1520 + (i%5)*380 + 1870*(j/4) + (j%4)*550 + 2244*(k/3) + (k%3)*850); } else if(n < w){ break; } } } }
a.cc: In function 'int main()': a.cc:24:4: error: expected '}' at end of input 24 | } | ^ a.cc:9:1: note: to match this '{' 9 | { | ^
s199730607
p00106
C++
#include <iostream> #include <algorithm> using namespace std; const int inf = 999999; int func(int n) { int r = inf, w; for(int i = 0; i <= 25; i++){ for(int j = 0; j <= 17; j++){ for(int k = 0; k <= 10; k++){ w = i*200+j*300+k*500; if(n == w){ r = min(r, (i/5)*1520 + (i%5)*380 + 1870*(j/4) + (j%4)*550 + 2244*(k/3) + (k%3)*850); } else if(n < w){ break; } } } }
a.cc: In function 'int func(int)': a.cc:24:4: error: expected '}' at end of input 24 | } | ^ a.cc:9:1: note: to match this '{' 9 | { | ^ a.cc:24:4: warning: no return statement in function returning non-void [-Wreturn-type] 24 | } | ^
s387147158
p00106
C++
#include <iostream> #include <algorithm> using namespace std; const int inf = 999999; int func(int n;) { int r = inf, w; for(int i = 0; i <= 25; i++){ for(int j = 0; j <= 17; j++){ for(int k = 0; k <= 10; k++){ w = i*200+j*300+k*500; if(n == w){ r = min(r, (i/5)*1520 + (i%5)*380 + 1870*(j/4) + (j%4)*550 + 2244*(k/3) + (k%3)*850); } else if(n < w){ break; } } } }
a.cc:8:15: error: expected ')' before ';' token 8 | int func(int n;) | ~ ^ | ) a.cc:8:16: error: expected unqualified-id before ')' token 8 | int func(int n;) | ^
s785627873
p00106
C++
#include<iostream> #include<cmath> using namespace std; int grum[3]={200,300,500}; int val[3]={380,550,850}; double dis[3]={0.8,0.85,0.88}; int dis_c[3]={5,4,3}; int main() { int ans[5001]; for(int i = 500; i < 5100; i+=100) { ans[i]=INT_MAX; for(int j = 0; j <= 25; ++j) { for(int k = 0; k <= 17; ++k) { for(int l = 0; l <= 10 ; ++l) { if(j*200+k*300+l*500<i) { continue; } int tmp=0; tmp+=(j-j%5)*380*0.8+j%5*380; tmp+=(k-k%4)*550*0.85+k%4*550; tmp+=(l-l%3)*850*0.88+l%3*850; ans[i]=min(ans[i],tmp); } } } } int n; while(cin>>n,n) { cout<<ans[n]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:24: error: 'INT_MAX' was not declared in this scope 14 | ans[i]=INT_MAX; | ^~~~~~~ a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include<cmath> +++ |+#include <climits> 3 | using namespace std;