답안 #235016

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
235016 2020-05-26T17:58:34 Z Nodir_Bobiev Languages (IOI10_languages) C++17
컴파일 오류
0 ms 0 KB
#include "grader.h"
#include "lang.cpp"

#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,n,nl, uni[N], correct, tot;
int language(int L) {
   if (L < 0 || L >= 56) exit(92);
   correct += (L == lnum);
   tot++;
   return lnum;
}

int main(){
   freopen("grader.in.1", "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);
      if( tot == 1000 )break;
   }
   printf("OK %0.2lf%%\n",100.0*correct/tot);
   return 0;
}

Compilation message

lang.cpp: In function 'int main()':
lang.cpp:21:11: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    freopen("grader.in.1", "r", stdin);
    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
lang.cpp:29: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:30:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       scanf("%*[^\n]");
       ~~~~~^~~~~~~~~~~
/tmp/ccQDeTPg.o: In function `language(int)':
grader.c:(.text+0x0): multiple definition of `language(int)'
/tmp/cc2pRtk9.o:lang.cpp:(.text+0x0): first defined here
/tmp/ccQDeTPg.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/cc2pRtk9.o:lang.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status