제출 #529184

#제출 시각아이디문제언어결과실행 시간메모리
529184Icebear16DNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include "dna.h" int n,q; void init(std::string a, std::string b) { while(q--){ int x,y; get_distance(x,y); } } 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:12:6: error: 'a' was not declared in this scope
   12 |   if(a[i]=='A'){
      |      ^
dna.cpp:19:6: error: 'b' was not declared in this scope
   19 |   if(b[i]=='A'){
      |      ^
dna.cpp:30:7: error: 'a' was not declared in this scope
   30 |    if(a[i]!=b[i]){
      |       ^
dna.cpp:30:13: error: 'b' was not declared in this scope
   30 |    if(a[i]!=b[i]){
      |             ^