제출 #1142633

#제출 시각아이디문제언어결과실행 시간메모리
1142633younesb13DNA 돌연변이 (IOI21_dna)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "dna.h" using namespace std; string A; string dna_b; void init(string a, string b) { A=a; A=b; return; } int get_distance(int y, int x) { int a=0; int t=0; int r=0; for (int i=y;i<x+1;i++) { if(A[i]=='A') { a++; } if(B[i]=='A') { a--; } if(A[i]=='T') { t++; } if(B[i]=='T') { t--; } if(A[i]!=B[i]) { r++; } } if (a==0 && t==0) { return r/2+r%2; } else { return -1; } }

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

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:20:12: error: 'B' was not declared in this scope
   20 |         if(B[i]=='A') {
      |            ^
dna.cpp:26:12: error: 'B' was not declared in this scope
   26 |         if(B[i]=='T') {
      |            ^
dna.cpp:29:18: error: 'B' was not declared in this scope
   29 |         if(A[i]!=B[i]) {
      |                  ^