Page 4 of 5
Re: 11063 - B2-Sequence
Posted: Mon Jun 02, 2008 11:31 am
by rio
Part that has bug;
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
Re: 11063 - B2-Sequence
Posted: Mon Jun 02, 2008 11:38 am
by Obaida
I know from the problem that I had to check all the sums are equal or not.
I was using nested loop to check all the values:
Code: Select all
for(i=1;i<=k;i++)
{
for(j=i+1;j<=k;j++)
{
how it can be wrong?
In the other side while taking input i was testing whether they satisfy B2 sequence or not.
What is the mistake there?
Re: 11063 - B2-Sequence
Posted: Wed Jul 30, 2008 2:12 pm
by Obaida
I changed my code on that two point but got WA again!!!(sorry for my previous post).
Re: 11063 - B2-Sequence
Posted: Sun Sep 14, 2008 1:59 am
by x140l31
please help!!!! I'm desesperate T.T
what's wrong in this code? T.T
Re: 11063 - B2-Sequence
Posted: Tue Nov 04, 2008 10:11 am
by Obaida
I have my Acc.. now.

11063 - B2-Sequence
Posted: Sat Nov 22, 2008 10:32 pm
by samin
plz can any one tell me what's the problem in thi code?
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;
}
Re: 11063 - B2-Sequence
Posted: Sat Dec 27, 2008 2:57 pm
by rehan
can any one tell me what is the wrong with my code
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;
}
Re: 11063 - B2-Sequence
Posted: Tue Dec 30, 2008 1:18 pm
by mukit
To rehan,
After each test case you must print a blank line.
and to samin,
For Input :
Output :
For both of you , check the board first and remove your code after AC.
Re: 11063 - B2-Sequence
Posted: Fri Jan 02, 2009 7:26 pm
by saiful_sust
Code: Select all
CUT.............after ACC........ :lol: :lol: :lol:
Re: 11063 - B2-Sequence
Posted: Tue Feb 17, 2009 6:53 pm
by lionking
could someone tell me why I always get WA?
I have check following terms:
i. the sequence is strickly increase
ii. the first term is larger than 0
iii. all pairwise sums are different
Do I lose something?
plz tell me~~~
thanks!!
Here is my code:
Re: 11063 - B2-Sequence
Posted: Sun Jul 19, 2009 3:37 pm
by liauys
Sorry, code removed
Hi saiful.. These are the cases for you:
None of them is b2 sequence.
Re: 11063 - B2-Sequence
Posted: Sat Sep 19, 2009 12:47 am
by saiful_sust
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
Re: 11063 - B2-Sequence
Posted: Thu Oct 29, 2009 7:13 pm
by hafez_hafez
i've alot of WA :s why anybody helppppppppppppppppppp
#include<iostream>
#include<string>
using namespace std ;
bool aray[1000000];
int ar[100000];
int main()
{
int n , sum ;
int t = 1 ;
while(cin >> n )
{
fill(aray , aray+1000000 , false);
bool flage = true , flg = false;
for(int i = 0 ; i < n ; i++)
{
cin >> ar ;
}
for(int i = 0 ; i < n ; i ++)
{
if(ar < 1 || ar <= ar[i-1])
{
cout <<"Case #"<<t<<": It is not B2-Sequence."<<endl<<endl;
flg = true;
break;
}
}
if(flg)
{
t++;
continue;
}
for(int i = 0 ; i < n ; i++)
{
for(int j = i ; j < n ; j++)
{
sum = ar + ar[j] ;
if(aray[sum])
{
flage = false ;
break;
}
aray[sum] = true ;
}
if(!flage)
{
cout << "Case #"<<t<<": It is not a B2-Sequence."<<endl<<endl;
break;
}
}
if(flage)
cout <<"Case #"<<t<<": It is a B2-Sequence."<<endl<<endl;
t++;
}
return 0;
}
Re: 11063 - B2-Sequence
Posted: Sat Oct 31, 2009 7:04 am
by lnr
Accepted.
Re: 11063 - B2-Sequence
Posted: Tue Dec 21, 2010 6:00 am
by Eather
Why WA?
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;
}
Please help me