题目链接: CodeForces 378A Playing with Dice
题目大意:两个人猜数1~6,给出a和b,然后随机丢一个色子,问说接近a的可能,相等的可能,以及接近b的可能。
解题思路:完完全全的签到题。
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
int a, b;
int x = 0, y = 0, z = 0;
scanf("%d%d", &a, &b);
for (int i = 1; i <= 6; i++) {
if (abs(i - a) > abs(i - b)) z++;
else if (abs(i - a) == abs(i - b)) y++;
else x++;
}
printf("%d %d %d\n", x, y, z);
return 0;
}