skpro19's blog

By skpro19, history, 5 years ago, In English

Why am I getting WA in this code?

I am dividing 'x' by all the prime numbers. To find the prime numbers, I am using the sieve. I know, it can be done without using the sieve, but when I am using the sieve, I am getting WA. Can someone please help ?

Div 2E: Counting Arrays

My code

It would be really kind if someone could point out the bug.

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

5 years ago, # |
  Vote: I like it +2 Vote: I do not like it

Use xx instead of x to check for divisors of original x in this part of code:

		for (int i = 1; i * i <= xx; i++) {

			if (xx % i == 0) {

				int a = i, b = xx / i; 

AC solution: 32667979