More actions
imported>Unknown No edit summary |
(Repair MoniWiki formatting after migration) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
= JollyJumpers = | = [[JollyJumpers]] = | ||
== | == | ||
<code>JollyJumpler.cpp</code> | |||
== | == | ||
#include<iostream> | #include<iostream> | ||
| Line 14: | Line 14: | ||
int oldInput=0; | int oldInput=0; | ||
int total=0; | int total=0; | ||
int array | int array[3000]={0,}; | ||
while(cin>>input) | while(cin>>input) | ||
| Line 20: | Line 20: | ||
count++; | count++; | ||
if(count!=1) | if(count!=1) | ||
array | array[count-2]=abs(oldInput-input); | ||
oldInput=input; | oldInput=input; | ||
} | } | ||
| Line 36: | Line 36: | ||
for(int j=0;j<count-1;j++) | for(int j=0;j<count-1;j++) | ||
{ | { | ||
if(array | if(array[j]==i) | ||
{ | { | ||
checker++; | checker++; | ||
| Line 50: | Line 50: | ||
== 태클 == | == 태클 == | ||
역할 분담이 필요 --[[강희경]] | 역할 분담이 필요 --[[강희경]] | ||
* 응 알았어 ㅠㅠ -- | * 응 알았어 ㅠㅠ --김회영 | ||
Latest revision as of 00:34, 29 March 2026
JollyJumpers
==
JollyJumpler.cpp
==
#include<iostream>
using namespace std;
#include<math.h>
bool seqCheck(int* array,int count);
void main()
{
int input=0;
int count=0;
int oldInput=0;
int total=0;
int array[3000]={0,};
while(cin>>input)
{
count++;
if(count!=1)
array[count-2]=abs(oldInput-input);
oldInput=input;
}
if(seqCheck(array,count))
cout<<"It is Jolly Jumper!\n";
else
cout<<"It isn't Jolly jumper!\n";
}
bool seqCheck(int* array,int count)
{
int checker=0;
for(int i=count-1;i>0;i--)
for(int j=0;j<count-1;j++)
{
if(array[j]==i)
{
checker++;
break;
}
}
if(checker==count-1)
return true;
return false;
}
태클
역할 분담이 필요 --강희경
- 응 알았어 ㅠㅠ --김회영