Code: Select all
int pot = 1;
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]<pot)b=0;
pot = a[i];
}
Code: Select all
for(i=1;i<=k;i++)
{
for(j=i+1;j<=k;j++)
{
Rio
Moderator: Board moderators
Code: Select all
int pot = 1;
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]<pot)b=0;
pot = a[i];
}
Code: Select all
for(i=1;i<=k;i++)
{
for(j=i+1;j<=k;j++)
{
Code: Select all
for(i=1;i<=k;i++)
{
for(j=i+1;j<=k;j++)
{
Code: Select all
removed
Code: Select all
#include<stdio.h>
int uni[20001];
int main()
{
int a[100];
int i,j,n,t=0,flag;
while(scanf("%d",&n)!= EOF)
{
for(i=0;i<=20000;i++)
uni[i] = 0;
t++;
flag = 1;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]<=0)
flag = 0;
}
for(i=0;i<=n-1 && flag;i++)
{
for(j=i;j<=n-1;j++)
{
if(uni[a[i]+a[j]] == 1 || a[i] >= a[j])
{
flag = 0;
break;
}
else
uni[a[i]+a[j]] = 1;
}
}
if(flag)
printf("Case #%d: It is a B2-Sequence.\n\n",t);
else
printf("Case #%d: It is not a B2-Sequence.\n\n",t);
}
return 0;
}
Code: Select all
#include<stdio.h>
int main()
{
int a[1000],m=0,n,j,i,k,l,x,y,c[1000];
while(scanf("%d",&n)==1)
{
m++;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
l=0;
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
if(a[j]<=a[i])
{
l=0;
break;
}
k=0;
for(i=0;i<n;i++)
for(j=i;j<n;j++)
{
c[k]=a[i]+a[j];
k++;
}
for(i=0;i<k-1;i++)
for(j=i+1;j<k;j++)
{
if(c[i]==c[j])
{l=1;
break;}
}
if(l==0)
printf("Case #%d: It is a B2-Sequence.\n",m);
else
printf("Case #%d: It is not a B2-Sequence.\n",m);
}
return 0;
}
and to samin,After each test case you must print a blank line.
Code: Select all
2
2 10
Code: Select all
Case #1: It is a B2-Sequence.
AT first i see the topic present on the board
all is ok BUT the judge saw WA
here is my code plz help me...
![]()
![]()
![]()
![]()
![]()
![]()
Code: Select all
CUT.............after ACC........ :lol: :lol: :lol:
Code: Select all
remove after got AC
Code: Select all
2
2 2
4
1 3 6 9
Hi liauys thanks for ur help .......
one thing u do not need to show all my code here
PLZ remove my code only.......
I found my mistake and got acc.....
keep posting.....thanks![]()
![]()
Code: Select all
/*in the name of Allah */
#include <list>
#include <deque>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<limits>
#include <stack>
#include<vector>
#include<cstring>
#include<cstdio>
using namespace std;
# define MEM(array,w) memset(array,w,sizeof array)
# define fr(i,a,b) for(int (i) = a ; i < b ; i++)
# define SET set<int>::iterator it = s.begin(); it != s.end();it++
# define ULL unsigned long long
# define eps 1e-9
# define LL long long
# define IS istringstream
# define fri(i,a,b) for(int (i) = a ; i <= b ; i++)
# define mfr(i,a,b) for(int (i) = a ; i > b ; i--)
# define mfri(i,a,b) for(int (i) = a ; i >= b ; i--)
# define PII pair<int , int>
#define all(c) (c).begin(), (c).end()
#define maxint 1 << 31 - 1
#define GI ({int _t; scanf("%d", &_t); _t;})
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, a) FOR(i, 0, a)
template<class T> string toString(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}
int toInt(string s){int r=0;istringstream sin(s);sin>>r;return r;}
#define DBG(x) cout << #x << "::" << x << endl;
#define DBGV(_v) { REP(_i, _v.size()) { cout << _v[_i] << "\t";} cout << endl;}
bool isprime(int n)
{
if( n<2) return 0;
for( int i=2; i*i<=n ; i++)if(n%i==0)return 0; return 1;
return 0;
}
int main()
{
int Ti;
int ca=0;
while(cin>>Ti){
int Arr[102];
int flg=0;
for(int i=0;i<Ti;i++)
{
cin>>Arr[i];
if(i>0 && Arr[i]<=Arr[i-1])flg=1;
if(i>=2)if(Arr[i]==(Arr[i-1]+Arr[i-2]))flg=1;
}
if(flg==1)
{
printf("Case #%d: It is not a B2-Sequence.\n\n",++ca);
}
else printf("Case #%d: It is a B2-Sequence.\n\n",++ca);
}
return 0;
}