Submit | All submissions | Best solutions | Back to list |
KRIPTO - Kripto |
Little Petar is playing a very frustrating online game, and is eager to advance on the leaderboard of best players. He has decided to use his hacker abilities and send an HTTP request for a score change. However, he hadn't anticipated that the committee had installed a new manner of protection against hackers -- requests with unrealistically high scores are actually written in the database modulo M (where M is a given number). Petar managed to find out the value of M, however he is still unfamiliar with the modulo operation, hence he has asked for your help in determining how many points will he achieve for a given request.
Input
The first and only line of the standard input contains two integers N and M, the score Petar has requested and the committee's modulo.
Output
Write to the standard output a single line containing the number of achieved points for the given request.
Example
Input: 15 7 Output: 1
Explanation
Petar has requested the score of 15, however the committee considers all scores above 7 to be unrealistic; as such, the value actually recorded will be equal to the score modulo 7, i.e. 1 in this case.
Constraints
- 0 <= N <= 10100000
- 1 <= M <= 1018
Added by: | PetarV |
Date: | 2015-04-08 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C C++ 4.3.2 CPP CPP14 C99 PAS-GPC PAS-FPC |
Resource: | Serbian Qualifications 2014 (Own problem) |
hide comments
2015-04-08 19:00:09 Bhavik
@PetarV: This is a tutorial problem.. Re (PetarV): Fair enough. Problem moved to tutorials. Have a go at solving some of the other problems I recently uploaded (RETRO, SEGFAULT, CARINA, SPLITS, FRONT). Last edit: 2015-04-08 20:21:17 |