• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
HaibaraAi
博客园    首页    新随笔    联系   管理    订阅  订阅

Codeforce Round #222 Div2 A

A. Playing with Dice
time limit per test 1 second
memory limit per test 256 megabytes
 

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?

Input

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.

Output

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.

Sample test(s)
Input
2 5
Output
3 0 3
Input
2 4
Output
2 1 3
Note

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 }
View Code
posted @ 2014-01-01 13:28  HaibaraAi  阅读(124)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3