TOPIC

why runtime error

Tanbir ahmed momin asked 5 months ago

include include define pf printf define sf scanf

int main() {

char vajjo[100000];
long long i,vajok,vagses= 0;

  sf("%s",vajjo);
  sf("%lld",&vajok);

  int lenth = strlen(vajjo);

  for(i=0;i<lenth;i++)
  {

      vagses = ((vagses*10)+ (vajjo[i]-'0'))% vajok;
  }

  pf("%lld\n",vagses);

}

Remember not post solutions. Your post may be reviewed by our moderators.

  • feodorv replied 5 months ago

    char vajjo[100000];

    At least one additional byte (for '\0') should be added.

  • Tarcísio Mazur Junior replied 5 months ago

    A (1 <= A <= 10 ^ 100000)

    'A' is a giant number, you will need 41,524 bytes to represent only A, and a long long int is only 8 bytes. This problem will make you implement a class that represents this number and divide it using division methods. I suggest that you solve the problem 1722 first: https://www.urionlinejudge.com.br/judge/en/problems/view/1722 which you will also need a class of giant numbers, but the operation is sum

    MOD