20pts 可能输出错
  • 板块P1537 弹珠
  • 楼主darksea
  • 当前回复1
  • 已保存回复1
  • 发布时间2025/7/28 21:02
  • 上次更新2025/7/29 10:36:08
查看原帖
20pts 可能输出错
1455258
darksea楼主2025/7/28 21:02

错误原因是这个

20pts,AC点2,3,hack过了

玄关

#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[7],k,sum;   
void darksea(int sum, int k) {
	for(int i1 = 0; i1 <= a[1]; i1++)
		for(int i2 = 0; i2 <= a[2]; i2++)
			for(int i3 = 0; i3 <= a[3]; i3++)
				for(int i4 = 0; i4 <= a[4]; i4++)
					for(int i5 = 0; i5 <= a[5]; i5++)
						for(int i6 = 0; i6 <= a[6]; i6++){
							int mid = i1+2*i2+3*i3+4*i4+5*i5+6*i6;
							if(mid == sum/2){ 
								cout<<"Collection #"<<k<<':'<<endl;
								cout<<"Can be divided."<<endl;
								return;
							}
						}
	cout<<"Collection #"<<k<<':'<<endl;
	cout<<"Can't be divided."<<endl;
}

signed main() {
	bool first = true; 
	while(true){
		k++;
		sum = 0;
		int tmp = 0;
		for(int i = 1; i <= 6; i++){
			cin>>a[i];
			sum += i*a[i];
			if(!a[i]) tmp++;
		}
		if(tmp == 6) break;
		if(!first) cout << endl;
		first = false;
		darksea(sum,k);
	}
	return 0;
}
2025/7/28 21:02
加载中...