Codeforce Round #222 Div2 A
Two players are playing a game. First each of them writes an integer from 1 to 6, and then a dice is thrown. The player whose written number got closer to the number on the dice wins. If both payers have the same difference, it's a draw.
The first player wrote number a, the second player wrote number b. How many ways to throw a dice are there, at which the first player wins, or there is a draw, or the second player wins?
The single line contains two integers a and b (1 ≤ a, b ≤ 6) — the numbers written on the paper by the first and second player, correspondingly.
Print three integers: the number of ways to throw the dice at which the first player wins, the game ends with a draw or the second player wins, correspondingly.
2 5
3 0 3
2 4
2 1 3
The dice is a standard cube-shaped six-sided object with each side containing a number from 1 to 6, and where all numbers on all sides are distinct.
You can assume that number a is closer to number x than number b, if |a - x| < |b - x|.
1 #pragma comment(linker,"/STACK:102400000,102400000") 2 #include <cstdio> 3 #include <vector> 4 #include <cmath> 5 #include <stack> 6 #include <queue> 7 #include <cstring> 8 #include <iostream> 9 #include <algorithm> 10 using namespace std; 11 #define INF 0x7fffffff 12 #define mod 1000000007 13 #define ll long long 14 #define maxn 506 15 #define pi acos(-1.0) 16 #define FF(i,n) for(int i=0;i<n;i++) 17 int n, m, z, t, flag, k; 18 int main(){ 19 cin >> n >> m; 20 int nn = max(n, m), mm = min(n, m); 21 z = 6 - (nn + mm) / 2; 22 if (abs(n - m) % 2 == 0)t = 1; 23 if (n == m)t = 6,z=0,k=0; 24 k = 6 - t - z; 25 if (n<m)swap(z, k); 26 printf("%d %d %d\n", z, t, k); 27 }
浙公网安备 33010602011771号