Last active
September 26, 2018 16:17
-
-
Save WindAzure/683d808df20139d0c25b4a293b59beba to your computer and use it in GitHub Desktop.
UVa 756
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
auto physical = 0, emotional = 0, intellectual = 0, dayAlreadyPassed = 0, T = 1; | |
while (~scanf("%d%d%d%d", &physical, &emotional, &intellectual, &dayAlreadyPassed)) | |
{ | |
if (physical == -1 && emotional == -1 && intellectual == -1 && dayAlreadyPassed == -1) break; | |
physical %= 23; | |
emotional %= 28; | |
intellectual %= 33; | |
auto triplePeak = (5544 * physical + 14421 * emotional + 1288 * intellectual) % 21252; | |
auto result = triplePeak - dayAlreadyPassed; | |
result = result > 0 ? result : result + 21252; | |
printf("Case %d: the next triple peak occurs in %d days.\n", T++, result); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment