Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
数据有点儿弱SCSE10_Candybox 2769 Accepted 224K 297MS C++ 606B 贡献了两个RE,NN=500和5000的时候RE了..然后50000就过了...踩一脚 #include <iostream> using namespace std; const int NN=50000; int t,a[NN],n; bool work(int x) { bool f[NN]; memset(f,0,sizeof(f)); for (int i=1;i<=n;++i) if (f[a[i]%x]) return false; else f[a[i]%x]=1; return true; } int main() { scanf("%d",&t); for (int xx=1;xx<=t;++xx) { scanf("%d",&n); for (int i=1;i<=n;++i) scanf("%d",&a[i]); for (int v=n;;++v) { if (work(v)) { printf("%d\n",v); break; } } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator