Official
		
		
			
		
		
			
	
B - Modulo Number Editorial by en_translator
This problem asks to find the remainder when \(N\) is divided by \(998244353\).
In many languages, we can use the operator % to find the remainder.  In Python, the following code is accepted:
Sample code (Python):
n = int(input())
print(n % 998244353)
However, in c++, a similar implementation results in WA (Wrong Answer). Why?
This is because different languages have different specifications of remainder when dividing negative numbers. In some languages, a negative remainder is obtained, so we need to modify to make it \(0\) or greater.
Sample code (c++):
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int main() {
    long long n;
    cin >> n;
    n %= mod;
    if(n < 0) n += mod;
    cout << n << endl;
}
				posted:
				
				
				last update: