8개 숫자가 주어졌을 때
1부터 8까지면 ascending
8부터 1까지면 descending
아니면 mixed 출력
#include<iostream>
using namespace std;
int main(int argc, char** argv)
{
int a,b,c,d,e,f,g,h;
cin >> a >> b >> c >> d >> e >> f >> g >> h;
if(a==1){
if(a+1==b){
if(b+1 ==c){
if(c+1==d){
if(d+1==e){
if(e+1==f){
if(f+1==g){
if(g+1==h){
cout << "ascending";
return 0;
}
else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}
else if(a==8){
if(a-1==b){
if(b-1 ==c){
if(c-1==d){
if(d-1==e){
if(e-1==f){
if(f-1==g){
if(g-1==h){
cout << "descending";
return 0;
}
else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}else{
cout << "mixed";
return 0;
}
}
else{
cout << "mixed";
return 0;
}
}
#include<iostream>
using namespace std;
int main(int argc, char** argv)
{
int a, b, c, d, e, f, g, h;
cin >> a >> b >> c >> d >> e >> f >> g >> h;
if(a==1 && b==2 && c==3 && d==4 && e==5 && f==6 && g==7 && h==8){
cout << "ascending";
}else if(a==8 && b==7 && c==6 && d==5 && e==4 && f==3 && g==2 && h==1){
cout << "descending";
}else{
cout << "mixed";
}
return 0;
}
#include<iostream>
using namespace std;
int main(int argc, char** argv)
{
int a, b, c, d, e, f, g, h;
cin >> a >> b >> c >> d >> e >> f >> g >> h;
if(a<b && b<c && c<d && d<e && e<f && f<g && g<h){
cout << "ascending";
}else if(a>b && b>c && c>d && d>e && e>f && f>g && g>h){
cout << "descending";
}else{
cout << "mixed";
}
return 0;
}