제출 #1029391

#제출 시각아이디문제언어결과실행 시간메모리
1029391elpro123DNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include "dna.h" #include "bits/stdc++.h" using namespace std; string s, s2; int n; void init(string a, string b){ s = a; s2 = b; n = (int)s.size(); } int get_distance(int x, int y){ int a1=0, a2=0, c1=0, c2=0, t1=0, t2=0; for(int i=x; i<=y; ++i){ if(s[i] == 'A'){ a1++; } if(s[i] == 'C'){ c1++; } if(s[i] == 'T'){ t1++; } if(s2[i] == 'A'){ a2++; } if(s2[i] == 'C'){ c2++; } if(s2[i] == 'T'){ t2++; } } if(a1!=a2 || b1!=b2 || c1!=c2){ return -1; } bool check= true; for(int i=x; i<=y; i++){ if(s[i] != s2[i]){ check= false; } } if(check){ return 0; } int ans=0; for(int i=x; i<=y; i++){ if(s[i] != s2[i]){ ans++; } } return ans; }

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

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:37:15: error: 'b1' was not declared in this scope; did you mean 't1'?
   37 |  if(a1!=a2 || b1!=b2 || c1!=c2){
      |               ^~
      |               t1
dna.cpp:37:19: error: 'b2' was not declared in this scope; did you mean 't2'?
   37 |  if(a1!=a2 || b1!=b2 || c1!=c2){
      |                   ^~
      |                   t2