Whats wrong in C++ code? Python AC but C++ not (RE (SIGFPE)- 30 points)

Please check out the solutions:

  1. Python :: AC [100 Points]
  2. C++ Code :: RE (SIGFPE) [30 Points]
    Please let me fix it!
    Thank you.

From the constraints, you need to be able to read in values of N and K up to 10^{18}.

1 Like

Oh that’s it, just replacing int with long long, then it’s works.
Thanks for helping.

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
//  freopen("input.txt", "r", stdin);
  int t;
  cin>>t;
  while (t--) {
    long long n, k;
    cin>>n>>k;
    puts(((n / k) % k != 0) ? "YES" : "NO");
  }
  return 0;
}

Again thank you <3

1 Like