Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
ACM ICPC 2018 World Finals

Re:能过我给的数据就绝对能AC!!!

Posted by deng0515 at 2013-08-20 20:14:51 on Problem 1014
In Reply To:Re:能过我给的数据就绝对能AC!!! Posted by:deng0515 at 2013-08-20 20:14:08
这数据都能过怎么还是runtime error
附代码:
#include<iostream>
using namespace std;

int main()
{
	int sum=0,a[7];
	bool st[100000]={false};
	for(int i=1;i<7;i++)	{cin>>a[i]; sum+=i*a[i];}
	for(int p=1;a[1]||a[2]||a[3]||a[4]||a[5]||a[6];p++) 
	{
		st[0]=true;
		st[sum]=true;
		if(sum%2)	cout<<"Collection #"<<p<<":"<<endl<<"Can't be divided."<<endl;
		else 
		{
			for(int k=1;k<=6;k++)
				for(int i=1;i<=a[k];i++)
					for(int j=0;j<i*k;j++)
						if(st[j]==true) st[j+k]=true;
			if(st[sum/2]) cout<<"Collection #"<<p<<":"<<endl<<"Can be divided."<<endl;
			else cout<<"Collection #"<<p<<":"<<endl<<"Can't be divided."<<endl;
		}
		sum=0;
		for(int i=1;i<7;i++)	{cin>>a[i];sum+=i*a[i];}
	}
	system("pause");
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator