Submission #64480

# Submission time Handle Problem Language Result Execution time Memory
64480 2018-08-04T16:00:34 Z alenam0161 Languages (IOI10_languages) C++17
Compilation error
0 ms 0 KB
#include "grader.h"
#include "lang.h"

#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>

#define N 100

static char lang[20], lan[100][20];
static int lnum, i,j,k,n,nl, uni[N], right, tot;
int language(int L) {
   if (L < 0 || L >= 56) exit(92);
   right += (L == lnum);
   tot++;
  // printf("%d and %d\n",L,lnum);
   return lnum;
}

int main(){
   freopen("input.txt","r",stdin);
   for (n=0; 1 == scanf("%s",lang); n++) {
      for (i=0;i<nl && strcmp(lang,lan[i]);i++);
      strcpy(lan[i],lang);
      if (i == nl) {
         nl++;
      }
      lnum = i;
      for (i=0;i<N;i++) scanf("%d,",&uni[i]);
      scanf("%*[^\n]");
      excerpt(uni);
   }
   printf("OK %0.2lf%%\n",100.0*right/tot);
   return 0;
}

Compilation message

lang.cpp: In function 'int main()':
lang.cpp:22:11: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    freopen("input.txt","r",stdin);
    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
lang.cpp:30:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       for (i=0;i<N;i++) scanf("%d,",&uni[i]);
                         ~~~~~^~~~~~~~~~~~~~~
lang.cpp:31:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       scanf("%*[^\n]");
       ~~~~~^~~~~~~~~~~
lang.cpp: At global scope:
lang.cpp:12:22: warning: 'k' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                      ^
lang.cpp:12:20: warning: 'j' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                    ^
/tmp/cc6XgB4S.o: In function `language(int)':
grader.c:(.text+0x0): multiple definition of `language(int)'
/tmp/ccCnix4M.o:lang.cpp:(.text+0x0): first defined here
/tmp/cc6XgB4S.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccCnix4M.o:lang.cpp:(.text.startup+0x0): first defined here
/tmp/ccCnix4M.o: In function `main':
lang.cpp:(.text.startup+0xec): undefined reference to `excerpt(int*)'
/tmp/cc6XgB4S.o: In function `main':
grader.c:(.text.startup+0xf5): undefined reference to `excerpt(int*)'
collect2: error: ld returned 1 exit status