关于交互题
  • 板块灌水区
  • 楼主Zouzhuoxuan
  • 当前回复15
  • 已保存回复15
  • 发布时间2023/7/21 14:59
  • 上次更新2023/11/3 08:26:16
查看原帖
关于交互题
800322
Zouzhuoxuan楼主2023/7/21 14:59

rt.

我想写个交互题,于是写了一个 interactive_lib.cpp,内容如下:

#include<bits/stdc++.h>
#include"testlib.h"
#define int long long
using namespace std;

signed main(int argc,char** argv)
{
	registerInteraction(argc, argv);
	int n,x,f,s=0;
	n=inf.readLong(),x=inf.readLong();
	cout.flush();
	cout<<n<<" "<<x<<endl;
	f=ouf.readInt(0,1);
	if(n%(x+1)==0) s=1;
	if(f!=s) cout<<-2<<endl,quitf(_wa,"Successively wrong.");
	if(f==0)
	{
		int in;
		in=ouf.readLong(1,x);
		if(in!=n%(x+1)) quitp(0.3,"Choose wrong.You can got 0.3 point.");
	}
	n-=n%(x+1);
	while(n)
	{
		int ran=rnd.next(x);
		cout<<ran<<endl;
		n-=ran;
		cout.flush();
		int in;
		in=ouf.readLong(1,x);
		n-=in;
		if(n<0) quitf(_fail,"The number of pokers abnormal.");
		if(n%(x+1)!=0) cout<<-2<<endl,quitp(0.3,"Choose wrong.You can got 0.3 point.");
	}
	cout<<-1<<endl;quitf(_ok,"You accepted the game.");
}

接着我想把这个和 100100 个输入文件打包交上去,显示不行,又搞了 100100 个空的输出文件打包交上去。测试的时候显示CE

No valid executable file was produced by the compiler
/nix/store/js66s0xwjnzg0ggi2lq9bcvlk6x2za13-binutils-2.35.2/bin/ld: ./cc7jjBI8.o: in function `main':
src:(.text+0x0): multiple definition of `main'; /tmp/compiler_gmq8ugkv/lib.o:src:(.text.startup+0x0): first defined here
collect2: 错误:ld 返回 1

请问有没有人知道这是怎么回事?

2023/7/21 14:59
加载中...