Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int xp, nb, cnt = 0;
- scanf("%d %d", &xp, &nb);
- while((xp >= 1 && nb >= 2) || (xp >= 2 && nb >= 1))
- {
- cnt++;
- if(xp <= nb)
- {
- xp--;
- nb -= 2;
- }
- else
- {
- nb--;
- xp -= 2;
- }
- }
- printf("%d\n", cnt);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement