Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

JollyJumpers/김회영: Difference between revisions

From ZeroWiki
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]] =
==  
==  
~cpp JollyJumpler.cpp
<code>JollyJumpler.cpp</code>
==
==
  #include&lt;iostream&gt;  
  #include&lt;iostream&gt;  
Line 14: Line 14:
  int oldInput=0;  
  int oldInput=0;  
  int total=0;  
  int total=0;  
  int array[3000]={0,};
  int array&#91;3000&#93;={0,};
   
   
  while(cin&gt;&gt;input)  
  while(cin&gt;&gt;input)  
Line 20: Line 20:
  count++;  
  count++;  
  if(count!=1)  
  if(count!=1)  
  array[count-2]=abs(oldInput-input);  
  array&#91;count-2&#93;=abs(oldInput-input);  
  oldInput=input;
  oldInput=input;
  }  
  }  
Line 36: Line 36:
  for(int j=0;j&lt;count-1;j++)
  for(int j=0;j&lt;count-1;j++)
  {
  {
  if(array[j]==i)
  if(array&#91;j&#93;==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;
}

태클

역할 분담이 필요 --강희경

  • 응 알았어 ㅠㅠ --김회영