제출 #529182

#제출 시각아이디문제언어결과실행 시간메모리
529182Icebear16DNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include "dna.h" int n,q; void init(std::string a, std::string b) { } int get_distance(int x, int y) { int h1,h2,l1,l2,k1,k2; for(int i=x;i<=y;i++){ if(a[i]=='A'){ h1++; }else if(a[i]=='T'){ l1++; }else if(a[i]=='C'){ k1++; } if(b[i]=='A'){ h2++; }else if(b[i]=='T'){ l2++; }else if(b[i]=='C'){ k2++; } } if(h1==h2 && l1==l2 && k1==k2){ int j=0; for(int i=x;i<=y;i++){ if(a[i]!=b[i]){ j+=1; } } if(j%2==1){ j+=1; } return j/2; }else{ return -1; } }

컴파일 시 표준 에러 (stderr) 메시지

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:9:6: error: 'a' was not declared in this scope
    9 |   if(a[i]=='A'){
      |      ^
dna.cpp:16:6: error: 'b' was not declared in this scope
   16 |   if(b[i]=='A'){
      |      ^
dna.cpp:27:7: error: 'a' was not declared in this scope
   27 |    if(a[i]!=b[i]){
      |       ^
dna.cpp:27:13: error: 'b' was not declared in this scope
   27 |    if(a[i]!=b[i]){
      |             ^