Submission #1142595

#TimeUsernameProblemLanguageResultExecution timeMemory
1142595jadmeziani2DNA 돌연변이 (IOI21_dna)C++20
Compilation error
0 ms0 KiB
#include "dna.h"
#include <bits/stdc++.h>
using namespace std;
string c,d;

void init(std::string a, std::string b) {
    c=a;
    d=b;
}

int get_distance(int x, int y) {
    int count =0;
    int a=1;
    int c=5;
    int t=20;
    for(int i=0;i<(int) c.size();i++){
        if(c[i] == 'A'){
            count+=1;
        }
        else if(c[i] == 'C'){
            count+=2;
        }
        else if(c[i] == 'T'){
            count+=3;
        }
        
        if(d[i] == 'A'){
            count-=1;
        }
        else if(d[i] == 'C'){
            count-=2;
        }
        else if(d[i] == 'T'){
            count-=3;
        }
    }
    if(count !=0){
        return -1;
    }
    if(y-x % == 0){
        return (y-x)/2;
    }
    else{
        return (y-x+1)/2
    }
    return count;
}

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:16:27: error: request for member 'size' in 'c', which is of non-class type 'int'
   16 |     for(int i=0;i<(int) c.size();i++){
      |                           ^~~~
dna.cpp:17:13: error: invalid types 'int[int]' for array subscript
   17 |         if(c[i] == 'A'){
      |             ^
dna.cpp:20:18: error: invalid types 'int[int]' for array subscript
   20 |         else if(c[i] == 'C'){
      |                  ^
dna.cpp:23:18: error: invalid types 'int[int]' for array subscript
   23 |         else if(c[i] == 'T'){
      |                  ^
dna.cpp:40:14: error: expected primary-expression before '==' token
   40 |     if(y-x % == 0){
      |              ^~
dna.cpp:44:25: error: expected ';' before '}' token
   44 |         return (y-x+1)/2
      |                         ^
      |                         ;
   45 |     }
      |     ~