Kanao's blog

By Kanao, history, 2 weeks ago, In English

Hola Amigos ! I am a beginner and stuck with a Assiut University Training-Newcomers ques. https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/O this ques. My Approach : I inputted it as a string and then run a loop to search for the operators but I am unable to keep track of the two numbers upon which I am supposed to used the operators , idk how am I supposed to do that with strings. All suggestions and different approaches are welcomed. Thank-You

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
2 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Take a loop through input string.---find the index of operator.----

let the index be INDEX

NOW

let a and b be empty strings and s be input string

a = ""

b = ""

for (int i = 0 ; i < length (s) ; i ++ )

if i < INDEX :

        a += s[i]

  else if i > INDEX :

        b += s[i]

NOW YOU HAVE A AND B.

»
2 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Take input as string then run loop until you got an operator, so before this index is number a, and after this index is number b. You can use a bool type variable if you get number a and operator. First try with these hint. Still can't get this? check my code -> https://bpa.st/IQ5Q

»
2 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Take an input as : int a,b and char s then cin >> a >> s >> b, and depends on what is the char s print the result.