Iroha and Haiku I

问题 : Iroha and Haiku I
时间限制: 1 Sec 内存限制: 128 MB

题目描述
Iroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.
To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

Constraints
1≤A,B,C≤10
输入
The input is given from Standard Input in the following format:

A B C
输出
If it is possible to construct a Haiku by using each of the phrases once, print YES (case-sensitive). Otherwise, print NO.
样例输入 Copy
5 5 7
样例输出 Copy
YES
提示
Using three phrases of length 5, 5 and 7, it is possible to construct a Haiku.

#include <iostream>

using namespace std;

int main()
{
    int a[3];
    int k=0;
    bool B=false;
    for(int i=0;i<3;i++){
        cin>>a[i];
        if(a[i]==7){
            B=true;
            k=i;
        }
    }
    if(B){
        for(int i=0;i<3;i++){
            if(i!=k){
                if(a[i]!=5){
                    B=false;
                }else{
                    B=true;
                }
            }
            if(B==false){
                cout<<"NO";
                break;
            }
        }
    }else {
        cout<<"NO";
    }
    if(B==true){
        cout<<"YES";
    }
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值