zoukankan      html  css  js  c++  java
  • Sharing Cookies --AtCoder

    题目描述

    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.

    样例输入

    4 5

    样例输出

    Possible

    #include <iostream>
    #include <string>
    #include <cstdio>
    #include <cmath>
    #include <cstring>
    #include <algorithm>
    #include <vector>
    #include <queue>
    #define range(i,a,b) for(int i=a;i<=b;++i)
    #define rerange(i,a,b) for(int i=a;i>=b;--i)
    #define fill(arr,tmp) memset(arr,tmp,sizeof(arr))
    using namespace std;
    int n,m;
    void init(){
        cin>>n>>m;
    }
    void solve(){
        cout<<((!(n%3)||!(m%3)||!((m+n)%3))?"Possible":"Impossible")<<endl;
    }
    int main() {
        init();
        solve();
        return 0;
    }
    View Code
  • 相关阅读:
    [转载]利用WCF共享ASP.NET session实现WCF服务端验证
    【转载】WCF REST 工作总结一
    [转载]分享WCF聊天程序WCFChat
    【转载】化零为整WCF(14) 事务(Transaction)
    poj2513
    poj2696
    poj2503
    poj2506
    poj2590
    实践案例丨云连接CC实现跨区域多VPC与线下IDC Server互联
  • 原文地址:https://www.cnblogs.com/Rhythm-/p/9322187.html
Copyright © 2011-2022 走看看