当前位置: 代码迷 >> 综合 >> Contest3184 - 2021级新生个人训练赛第40场_E: Sharing Cookies
  详细解决方案

Contest3184 - 2021级新生个人训练赛第40场_E: Sharing Cookies

热度:81   发布时间:2023-12-06 05:33:42.0

//
问题 E: Sharing Cookies
时间限制: 1.000 Sec  内存限制: 128 MB题目描述
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.Constraints
1≤A,B≤100
Both A and B are integers.
输入
Input is given from Standard Input in the following format:
A B
输出
If it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.
样例输入 Copy
4 5
样例输出 Copy
Possible
提示
If Snuke gives nine cookies, each of the three goats can have three cookies.

//
#include<bits/stdc++.h>
using namespace std;// 1≤A,B≤100
const int MAXN=111;int main()
{   int a,b;while( ~scanf("%d%d",&a,&b) ){if( a%3==0 || b%3==0 || (a+b)%3==0 ) printf("Possible\n");else                                 printf("Impossible\n");}return 0;
}

  相关解决方案