问题 : 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;
}