Re: 10038 - Jolly Jumpers
Posted: Tue Oct 07, 2014 8:30 pm
It's still WA. . . .
http://ideone.com/nOw2Pd
http://ideone.com/nOw2Pd
Code: Select all
4 1 4 2 3
Code: Select all
Jolly
Code: Select all
1 2000
2 1999 1998
Code: Select all
Jolly
Jolly
Code: Select all
for (k = 1, i = 0; i < c - 1; i++)
Code: Select all
// AC
Code: Select all
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define MAX 3002
int main()
{
int a,b,flag =1;
int A[MAX];
while(cin>>a)
{
for(int i=1;i<=a;i++)
{
scanf("%d",&A[i]);
}
for(int i=1;i<a;i++)
{
b=abs(A[i]-A[i+1]);
{
if(b<1 ||b>a-1)
{
flag=0;
}
}
}
if(flag==1) printf("Jolly\n");
if(flag==0) printf("Not jolly\n");
}
return 0;
}
Code: Select all
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define MAX 3002
int main()
{
int a,b;
int A[MAX];
while(cin>>a)
{
int flag =1;
for(int i=1;i<=a;i++)
{
scanf("%d",&A[i]);
}
for(int i=1;i<a;i++)
{
b=abs(A[i]-A[i+1]);
{
if(b<1 ||b>a-1)
{
flag=0;
}
}
}
if(flag==1) printf("Jolly\n");
if(flag==0) printf("Not jolly\n");
}
return 0;
}
Don't forget to remove your code after getting accepted.brianfry713 wrote:4 1 2 3 6 is Not jolly
lighted wrote:Try input in this thread before posting.m1m6 wrote:how !!Doesn't match sample I/O.
try these....
1 1
2 1 2
output :
Jolly
Jolly
Code: Select all
Thanks, I got AC :D
m1m6 wrote:how !!Doesn't match sample I/O.
try these....
1 1
2 1 2
output :
Jolly
Jolly
Tnx Lighted for your replylighted wrote:This is accepted code.